Professional Documents
Culture Documents
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.26-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Database changed
mysql> SHOW TABLES;
+------------------+
| Tables_in_SCHOOL |
+------------------+
| EMPLOYEE |
| student |
+------------------+
2 rows in set (0.00 sec)
mysql> A+B=10
-> EXIT
->
-> ;
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 'A+B=10
EXIT' at line 1
mysql> SELECT A+B
-> 10+20;
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 '10+20' at line 2
mysql> SELECT A+B 10+20
-> ;
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 '10+20' at line 1
mysql> SELECT 20+30;
+-------+
| 20+30 |
+-------+
| 50 |
+-------+
1 row in set (0.00 sec)
mysql> SELECT * FROM student where s_name BETWEEN 'tt7f' AND 'XYZ';
+------+--------+-------+
| s_id | s_name | s_age |
+------+--------+-------+
| 11 | tt7f | 78 |
| 11 | tt7f | 78 |
| 101 | xyz | 56 |
+------+--------+-------+
3 rows in set (0.00 sec)
mysql> select * from student where exists(select s_id from student where s_name='abc');
+------+--------+-------+
| s_id | s_name | s_age |
+------+--------+-------+
| 10 | devraj | 29 |
| 20 | abc | 19 |
| 11 | tt7f | 78 |
| 11 | tt7f | 78 |
| 101 | xyz | 56 |
| 103 | Anil | 56 |
| 106 | Anand | 16 |
+------+--------+-------+
7 rows in set (0.00 sec)
mysql> select * from student where exists(select s_id from student where s_age=56);
+------+--------+-------+
| s_id | s_name | s_age |
+------+--------+-------+
| 10 | devraj | 29 |
| 20 | abc | 19 |
| 11 | tt7f | 78 |
| 11 | tt7f | 78 |
| 101 | xyz | 56 |
| 103 | Anil | 56 |
| 106 | Anand | 16 |
+------+--------+-------+
7 rows in set (0.00 sec)
mysql> select * from student where exists(selectes_id from student where s_age=56);
[1]+ Stopped mysql -u root -p
nivya@nivya-Lenovo-G580:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.26-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Database changed
mysql> select * from student where exists(selectes_id from student where s_age=56);
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 'selectes_id from student where
s_age=56)' at line 1
mysql> select * from student where exists(selecte e_id from student where s_age=56);
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 'selecte e_id from student where
s_age=56)' at line 1
mysql> select * from student where exists(select e_id from student where s_age=56);
ERROR 1054 (42S22): Unknown column 'e_id' in 'field list'
mysql> select * from student where exists(select s_name from student where s_age=56);
+------+--------+-------+
| s_id | s_name | s_age |
+------+--------+-------+
| 10 | devraj | 29 |
| 20 | abc | 19 |
| 11 | tt7f | 78 |
| 11 | tt7f | 78 |
| 101 | xyz | 56 |
| 103 | Anil | 56 |
| 106 | Anand | 16 |
+------+--------+-------+
7 rows in set (0.00 sec)
mysql> devarajmt.ece@gmail.com