mysql>
mysql>
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| mytest_project |
| performance_schema |
| practice |
| sakila |
| sys |
| world |
+--------------------+
8 rows in set (0.33 sec)
mysql> USE practice;
Database changed
mysql>
mysql>
mysql> SHOW TABLES;
+--------------------+
| Tables_in_practice |
+--------------------+
| department |
| employee |
| maleemployee |
| practice0705 |
+--------------------+
4 rows in set (0.01 sec)
mysql> SELECT * FORM employee;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FORM employee' at line 1
mysql> SELECT * FORM FOR employee;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FORM FOR employee' at line 1
mysql> SELECT * FROM employee;
+--------+----------+--------+------------+--------+--------+
| emp_id | name | gender | birthday | salary | dep_id |
+--------+----------+--------+------------+--------+--------+
| E00001 | 玲木太郎 | 男 | 1995-01-01 | NULL | NULL |
| E00002 | 佐藤次郎 | 男 | 1990-05-03 | 25000 | D001 |
| E00003 | 鈴木花子 | 女 | 1990-02-11 | 32500 | D002 |
| E00004 | 田中三郎 | 男 | 1975-11-03 | 40000 | D003 |
| E00005 | 高橋良子 | 女 | 1985-11-23 | 39000 | D003 |
| E00006 | 鈴木良枝 | 女 | 1970-05-05 | 58500 | D003 |
| E00007 | 佐藤健次 | 男 | 1980-05-05 | 35000 | D001 |
| E00008 | 山本井子 | 女 | 1996-10-25 | 32500 | D002 |
+--------+----------+--------+------------+--------+--------+
8 rows in set (0.29 sec)
mysql>
mysql>
mysql> SELECT (emp_id,name,gender) *FROM employee;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM employee' at line 1
mysql> SELECT(emp_id,name,gender) *FROM employee;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM employee' at line 1
mysql> SELECT(emp_id) *FROM employee;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM employee' at line 1
mysql>
mysql>
mysql> SELECT(emp_id,name,gender) FROM employee;
ERROR 1241 (21000): Operand should contain 1 column(s)
mysql>
mysql>
mysql> SELECT(emp_id,name,gender) FROM employee;
ERROR 1241 (21000): Operand should contain 1 column(s)
mysql> SELECT emp_id,name,gender FROM employee;
+--------+----------+--------+
| emp_id | name | gender |
+--------+----------+--------+
| E00001 | 玲木太郎 | 男 |
| E00002 | 佐藤次郎 | 男 |
| E00003 | 鈴木花子 | 女 |
| E00004 | 田中三郎 | 男 |
| E00005 | 高橋良子 | 女 |
| E00006 | 鈴木良枝 | 女 |
| E00007 | 佐藤健次 | 男 |
| E00008 | 山本井子 | 女 |
+--------+----------+--------+
8 rows in set (0.00 sec)
mysql> SELECT emp_id,name,gender FROM employee WHERE gender='男';
+--------+----------+--------+
| emp_id | name | gender |
+--------+----------+--------+
| E00001 | 玲木太郎 | 男 |
| E00002 | 佐藤次郎 | 男 |
| E00004 | 田中三郎 | 男 |
| E00007 | 佐藤健次 | 男 |
+--------+----------+--------+
4 rows in set (0.00 sec)
mysql>
mysql>
mysql> SELECT namem,salary,+5000 FROM employee
-> WHERE salary+5000>=30000;
ERROR 1054 (42S22): Unknown column 'namem' in 'field list'
mysql> WHERE salary+5000>=3000;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE salary+5000>=3000' at line 1
mysql>
mysql>
mysql> SELECT *FROM employee;
+--------+----------+--------+------------+--------+--------+
| emp_id | name | gender | birthday | salary | dep_id |
+--------+----------+--------+------------+--------+--------+
| E00001 | 玲木太郎 | 男 | 1995-01-01 | NULL | NULL |
| E00002 | 佐藤次郎 | 男 | 1990-05-03 | 25000 | D001 |
| E00003 | 鈴木花子 | 女 | 1990-02-11 | 32500 | D002 |
| E00004 | 田中三郎 | 男 | 1975-11-03 | 40000 | D003 |
| E00005 | 高橋良子 | 女 | 1985-11-23 | 39000 | D003 |
| E00006 | 鈴木良枝 | 女 | 1970-05-05 | 58500 | D003 |
| E00007 | 佐藤健次 | 男 | 1980-05-05 | 35000 | D001 |
| E00008 | 山本井子 | 女 | 1996-10-25 | 32500 | D002 |
+--------+----------+--------+------------+--------+--------+
8 rows in set (0.00 sec)
mysql> SELECT namem,salary,+5000 FROM employee
-> WHERE salary+5000>=300000;
ERROR 1054 (42S22): Unknown column 'namem' in 'field list'
mysql> SELECT namem,salary,+5000 FROM employee
-> WHERE salary+5000>=300000;
ERROR 1054 (42S22): Unknown column 'namem' in 'field list'
mysql> SELECT name,salary,+5000 FROM employee
-> WHERE salary+5000>=300000;
Empty set (0.00 sec)
mysql>
mysql>
mysql> WHERE salary+5000>=30000;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE salary+5000>=30000' at line 1
mysql> SELECT name,salary,+5000 FROM employee
-> WHERE salary+5000>=30000;
+----------+--------+------+
| name | salary | 5000 |
+----------+--------+------+
| 佐藤次郎 | 25000 | 5000 |
| 鈴木花子 | 32500 | 5000 |
| 田中三郎 | 40000 | 5000 |
| 高橋良子 | 39000 | 5000 |
| 鈴木良枝 | 58500 | 5000 |
| 佐藤健次 | 35000 | 5000 |
| 山本井子 | 32500 | 5000 |
+----------+--------+------+
7 rows in set (0.00 sec)
mysql> SELECT name,salary,+5000 FROM employee
-> WHERE salary+5000 >= 30000;
+----------+--------+------+
| name | salary | 5000 |
+----------+--------+------+
| 佐藤次郎 | 25000 | 5000 |
| 鈴木花子 | 32500 | 5000 |
| 田中三郎 | 40000 | 5000 |
| 高橋良子 | 39000 | 5000 |
| 鈴木良枝 | 58500 | 5000 |
| 佐藤健次 | 35000 | 5000 |
| 山本井子 | 32500 | 5000 |
+----------+--------+------+
7 rows in set (0.00 sec)
mysql> SELECT name,salary,salry+5000 FROM employee
-> WHERE salary+5000 >= 30000;
ERROR 1054 (42S22): Unknown column 'salry' in 'field list'
mysql> SELECT name,salary,salary+5000 FROM employee
-> WHERE salary+5000 >= 30000;
+----------+--------+-------------+
| name | salary | salary+5000 |
+----------+--------+-------------+
| 佐藤次郎 | 25000 | 30000 |
| 鈴木花子 | 32500 | 37500 |
| 田中三郎 | 40000 | 45000 |
| 高橋良子 | 39000 | 44000 |
| 鈴木良枝 | 58500 | 63500 |
| 佐藤健次 | 35000 | 40000 |
| 山本井子 | 32500 | 37500 |
+----------+--------+-------------+
7 rows in set (0.00 sec)
mysql>
mysql>
mysql> SELECT name,salary,salary+5000 FROM employee AS raise
-> WHERE raise>=30000;
ERROR 1054 (42S22): Unknown column 'raise' in 'where clause'
mysql> SELECT name,salary,salary+5000 AS raise
-> FROM employee
-> WHERE raise >=30000;
ERROR 1054 (42S22): Unknown column 'raise' in 'where clause'
mysql>
mysql>
mysql> SELECT name , salary , +5000 AS raise
-> FROM employee
-> WHERE salary+5000 >=30000;
+----------+--------+-------+
| name | salary | raise |
+----------+--------+-------+
| 佐藤次郎 | 25000 | 5000 |
| 鈴木花子 | 32500 | 5000 |
| 田中三郎 | 40000 | 5000 |
| 高橋良子 | 39000 | 5000 |
| 鈴木良枝 | 58500 | 5000 |
| 佐藤健次 | 35000 | 5000 |
| 山本井子 | 32500 | 5000 |
+----------+--------+-------+
7 rows in set (0.00 sec)
mysql> SELECT name , salary ,salary+5000 AS raise
-> FROM employee
-> WHERE raise >=30000;
ERROR 1054 (42S22): Unknown column 'raise' in 'where clause'
mysql>
mysql>
mysql> SELECT name AS dan
-> FROM employee
-> WHERE dan;
ERROR 1054 (42S22): Unknown column 'dan' in 'where clause'
mysql>
mysql>
mysql> SELECT name , salary ,salary+5000 AS raise
-> FROM employee
-> WHERE raise >=30000;
ERROR 1054 (42S22): Unknown column 'raise' in 'where clause'
mysql> SELECT name , salary ,salary+5000 AS raise
-> FROM employee
-> WHERE raise+5000 >=30000;
ERROR 1054 (42S22): Unknown column 'raise' in 'where clause'
mysql> SELECT *FROM employee AS raise;
+--------+----------+--------+------------+--------+--------+
| emp_id | name | gender | birthday | salary | dep_id |
+--------+----------+--------+------------+--------+--------+
| E00001 | 玲木太郎 | 男 | 1995-01-01 | NULL | NULL |
| E00002 | 佐藤次郎 | 男 | 1990-05-03 | 25000 | D001 |
| E00003 | 鈴木花子 | 女 | 1990-02-11 | 32500 | D002 |
| E00004 | 田中三郎 | 男 | 1975-11-03 | 40000 | D003 |
| E00005 | 高橋良子 | 女 | 1985-11-23 | 39000 | D003 |
| E00006 | 鈴木良枝 | 女 | 1970-05-05 | 58500 | D003 |
| E00007 | 佐藤健次 | 男 | 1980-05-05 | 35000 | D001 |
| E00008 | 山本井子 | 女 | 1996-10-25 | 32500 | D002 |
+--------+----------+--------+------------+--------+--------+
8 rows in set (0.00 sec)
mysql> SELECT FROM employee AS raise;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM employee AS raise' at line 1
mysql> SELECT *FROM employee AS raise;
+--------+----------+--------+------------+--------+--------+
| emp_id | name | gender | birthday | salary | dep_id |
+--------+----------+--------+------------+--------+--------+
| E00001 | 玲木太郎 | 男 | 1995-01-01 | NULL | NULL |
| E00002 | 佐藤次郎 | 男 | 1990-05-03 | 25000 | D001 |
| E00003 | 鈴木花子 | 女 | 1990-02-11 | 32500 | D002 |
| E00004 | 田中三郎 | 男 | 1975-11-03 | 40000 | D003 |
| E00005 | 高橋良子 | 女 | 1985-11-23 | 39000 | D003 |
| E00006 | 鈴木良枝 | 女 | 1970-05-05 | 58500 | D003 |
| E00007 | 佐藤健次 | 男 | 1980-05-05 | 35000 | D001 |
| E00008 | 山本井子 | 女 | 1996-10-25 | 32500 | D002 |
+--------+----------+--------+------------+--------+--------+
8 rows in set (0.00 sec)
mysql>
mysql>
mysql> SELECT name , salary ,salary+5000 AS raise
-> FROM employee
-> WHERE raise+5000 >=30000;
ERROR 1054 (42S22): Unknown column 'raise' in 'where clause'
mysql> SELECT name , salary ,salary + 5000 AS raise
-> FROM employee
-> WHERE raise+5000 >=30000;
ERROR 1054 (42S22): Unknown column 'raise' in 'where clause'
mysql> SELECT name , salary ,salary + 5000 AS raise
-> FROM employee
-> WHERE raise + 5000 >=30000;
ERROR 1054 (42S22): Unknown column 'raise' in 'where clause'
mysql> SELECT name AS DAN
-> FROM employee
-> WHERE DAN;
ERROR 1054 (42S22): Unknown column 'DAN' in 'where clause'
mysql> SELECT name AS dan
-> FROM employee
-> WHERE name;
Empty set, 8 warnings (0.00 sec)
mysql> SELECT emp_id,name AS dan
-> FROM employee
-> WHERE dan;
ERROR 1054 (42S22): Unknown column 'dan' in 'where clause'
mysql> SELECT name , salary ,salary + 5000 AS raise
-> FROM employee
-> WHERE raise + 5000 >=30000;
ERROR 1054 (42S22): Unknown column 'raise' in 'where clause'
mysql> SELECT name , salary ,salary *0.7 AS cut FROM employee
-> WHERE salary * 0.7<30000;
+----------+--------+---------+
| name | salary | cut |
+----------+--------+---------+
| 佐藤次郎 | 25000 | 17500.0 |
| 鈴木花子 | 32500 | 22750.0 |
| 田中三郎 | 40000 | 28000.0 |
| 高橋良子 | 39000 | 27300.0 |
| 佐藤健次 | 35000 | 24500.0 |
| 山本井子 | 32500 | 22750.0 |
+----------+--------+---------+
6 rows in set (0.00 sec)
mysql>
mysql> SHOW DATABASES;
ERROR 2013 (HY000): Lost connection to MySQL server during query
No connection. Trying to reconnect...
Connection id: 13
Current database: practice
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| mytest_project |
| performance_schema |
| practice |
| sakila |
| sys |
| world |
+--------------------+
8 rows in set (0.06 sec)
mysql> USE mytest_project
Database changed
mysql>
mysql>
mysql> SELECT *FORM mytest_project;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FORM mytest_project' at line 1
mysql> SELECT *FROM mytest_project;
ERROR 1146 (42S02): Table 'mytest_project.mytest_project' doesn't exist
mysql> CREATE FORM TRY0707;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FORM TRY0707' at line 1
mysql> CREATE TABLE TRY0707;
ERROR 4028 (HY000): A table must have at least one visible column.
mysql> CREATE TABLE TRY0708;
ERROR 4028 (HY000): A table must have at least one visible column.
mysql> CREATE TABLE TRY0708(
-> number INT,name VARCHAR(10),position VARCHAR(6),point INT,
-> PRIMARY KEY(number));
Query OK, 0 rows affected (0.33 sec)
mysql>
mysql> SELECT * FORM TRY0708;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FORM TRY0708' at line 1
mysql> SELECT * FROM TRY0708;
Empty set (0.01 sec)
mysql>
mysql>
mysql> SHOW TABLES;
+--------------------------+
| Tables_in_mytest_project |
+--------------------------+
| try0708 |
+--------------------------+
1 row in set (0.00 sec)
mysql> INSERT INTO try0708
-> VALUES(1,'Booker','SG',33);
Query OK, 1 row affected (0.36 sec)
mysql> SELECT *FROM try0708;
+--------+--------+----------+-------+
| number | name | position | point |
+--------+--------+----------+-------+
| 1 | Booker | SG | 33 |
+--------+--------+----------+-------+
1 row in set (0.00 sec)
mysql>
mysql>
mysql>
mysql>
mysql>
mysql> INSERT INTO try0708
->
-> VALUES(3,'Paul','PG',23);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql>
mysql> INSERT INTO try0708
-> VALUES(22,'Ayton','C',14);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql>
mysql> INSERT INTO try0708
-> VALUES(99,'Crowder','SF',6);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql>
mysql> INSERT INTO try0708
-> VALUES(20,'Saric','C',2);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql>
mysql> INSERT INTO try0708
-> VALUES(25,'Brudges','F',10);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> INSERT INTO try0708
-> VALUES(10,'Smith','C',0);
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO try0708
-> VALUES(23,'Johnson','F',10);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> INSERT INTO try0708
-> VALUES(4,'Carter','G',11);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> INSERT INTO try0708
-> VALUES(55,'Moore','G',0);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> INSERT INTO try0708
-> VALUES(2,'Galloway','G',0);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql>
mysql> INSERT INTO try0708
-> VALUES(11,'Nader','F',0);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> INSERT INTO try0708
-> VALUES(12,'Craig','F',10);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> INSERT INTO try0708
-> VALUES(8,'Kaminsky','F-C',0);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> INSERT INTO try0708
-> VALUES(0,'Alexander','G',0);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> SELECT*FROM try0708;
+--------+-----------+----------+-------+
| number | name | position | point |
+--------+-----------+----------+-------+
| 0 | Alexander | G | 0 |
| 1 | Booker | SG | 33 |
| 2 | Galloway | G | 0 |
| 3 | Paul | PG | 23 |
| 4 | Carter | G | 11 |
| 8 | Kaminsky | F-C | 0 |
| 10 | Smith | C | 0 |
| 11 | Nader | F | 0 |
| 12 | Craig | F | 10 |
| 20 | Saric | C | 2 |
| 22 | Ayton | C | 14 |
| 23 | Johnson | F | 10 |
| 25 | Brudges | F | 10 |
| 55 | Moore | G | 0 |
| 99 | Crowder | SF | 6 |
+--------+-----------+----------+-------+
15 rows in set (0.00 sec)