Once you have installed MySQL and get MySQL service is running. We may launch the MySQL console in the command line in Windows:
c:/WHERE-MYSQL-INSTALLED/bin/mysql/mysql5.6.17/bin/mysql.exe
Once you have run the command you will have following lines in command window:
Welcome to the MySQL monitor. Commands end with ; or \\g.
Your MySQL connection id is 1
Server version: 5.6.17 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.
mysql>
Listing Available databases and Creating a new databasemysql> show schemas;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.02 sec)
mysql> create database machinelearning;
Query OK, 1 row affected (0.00 sec)
mysql> use machinelearning;
Database changed
Creating a new Table adding new Values into the Tablemysql> create table decisiontree1(
-> Outlook varchar(255),
-> Temperature varchar(255),
-> Humidity varchar(255),
-> Windy boolean,
-> PlayTennis varchar(255));
Query OK, 0 rows affected (0.39 sec)
mysql> INSERT INTO decisiontree1 VALUES('Rainy','Hot','High',FALSE,'No');
Query OK, 1 row affected (0.05 sec)
mysql> INSERT INTO decisiontree1 VALUES('Rainy','Hot','High',TRUE,'No');
Query OK, 1 row affected (0.06 sec)
mysql> INSERT INTO decisiontree1 VALUES('Overcast','Hot','High',FALSE,'Yes');
Query OK, 1 row affected (0.06 sec)
mysql> INSERT INTO decisiontree1 VALUES('Sunny','Mild','High',FALSE,'Yes');
Query OK, 1 row affected (0.06 sec)
mysql> INSERT INTO decisiontree1 VALUES('Sunny','Cool','Normal',FALSE,'Yes');
Query OK, 1 row affected (0.05 sec)
Displaying the table (Selecting all the columns and values)mysql> select * from decisiontree1;
+----------+-------------+----------+-------+------------+
| Outlook | Temperature | Humidity | Windy | PlayTennis |
+----------+-------------+----------+-------+------------+
| Rainy | Hot | High | 0 | No |
| Rainy | Hot | High | 1 | No |
| Overcast | Hot | High | 0 | Yes |
| Sunny | Mild | High | 0 | Yes |
| Sunny | Cool | Normal | 0 | Yes |
| Sunny | Cool | Normal | 1 | No |
| Overcast | Cool | Normal | 1 | Yes |
| Rainy | Mild | High | 0 | No |
| Rainy | Cool | Normal | 0 | Yes |
| Sunny | Mild | Normal | 0 | Yes |
| Rainy | Mild | Normal | 1 | Yes |
| Overcast | Mild | High | 1 | Yes |
| Overcast | Hot | Normal | 0 | Yes |
| Sunny | Mild | High | 1 | No |
+----------+-------------+----------+-------+------------+
14 rows in set (0.00 sec)
Author
İsmail Erdem Sırma
Senior Software Engineer