The document consists of a series of MySQL queries executed on a database containing student records. It includes queries to select students based on various criteria, such as city and name patterns, and demonstrates the results returned from these queries. Additionally, there are syntax errors noted in some queries, indicating issues with the SQL commands used.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
3 views7 pages
Demo
The document consists of a series of MySQL queries executed on a database containing student records. It includes queries to select students based on various criteria, such as city and name patterns, and demonstrates the results returned from these queries. Additionally, there are syntax errors noted in some queries, indicating issues with the SQL commands used.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7
mysql> select RN
-> from demo
-> where IP between 50 and 80; +------+ | RN | +------+ | 1| +------+ 1 row in set (0.11 sec)
mysql> select*from student
-> where city in ("jodhpur","jaipur","kota"); +--------+-----------+------------+---------+---------+-------+ | Rollno | Name | DOB | city | English | IP | +--------+-----------+------------+---------+---------+-------+ | 1101 | Abhishek | 1997-11-23 | jaipur | 91 | 92.95 | | 1103 | kapil | 1995-07-09 | kota | 90 | 98.20 | | 1107 | Krishna | 2005-09-06 | jodhpur | 89 | 95.00 | | 1111 | vidhi | 2007-11-25 | jodhpur | 74 | 86.94 | | 1112 | meenakshi | 2008-04-21 | jodhpur | 81 | 95.40 | | 1113 | karan | 2007-11-25 | jodhpur | 74 | 35.20 | | 1114 | sonu | 2008-03-14 | jodhpur | 29 | 52.20 | +--------+-----------+------------+---------+---------+-------+ 7 rows in set (0.07 sec)
mysql> select*from student
-> where city not in ("jodhpur","jaipur","kota"); +--------+---------+------------+-----------+---------+-------+ | Rollno | Name | DOB | city | English | IP | +--------+---------+------------+-----------+---------+-------+ | 1102 | Bhavesh | 1999-04-07 | rohtak | 86 | 80.56 | | 1105 | Namit | 2008-01-05 | delhi | 79 | 78.90 | | 1106 | sumit | 2006-08-25 | phalodi | 68 | 73.30 | | 1108 | pramod | 2007-09-12 | rajsamand | 79 | 80.45 | | 1109 | yuvraj | 2010-05-22 | jaisalmer | 65 | 94.02 | | 1110 | mukesh | 2009-11-28 | rohat | 57 | 91.48 | +--------+---------+------------+-----------+---------+-------+ 6 rows in set (0.00 sec)
mysql> select*from student
-> where name like 'a%'; +--------+----------+------------+--------+---------+-------+ | Rollno | Name | DOB | city | English | IP | +--------+----------+------------+--------+---------+-------+ | 1101 | Abhishek | 1997-11-23 | jaipur | 91 | 92.95 | +--------+----------+------------+--------+---------+-------+ 1 row in set (0.01 sec)
mysql> select*from student
-> where name like '%a'; +--------+---------+------------+---------+---------+-------+ | Rollno | Name | DOB | city | English | IP | +--------+---------+------------+---------+---------+-------+ | 1107 | Krishna | 2005-09-06 | jodhpur | 89 | 95.00 | +--------+---------+------------+---------+---------+-------+ 1 row in set (0.00 sec) mysql> select*from student -> where name like '__a'; Empty set (0.00 sec)
mysql> select*from student
-> where name like '__a%'; +--------+---------+------------+-----------+---------+-------+ | Rollno | Name | DOB | city | English | IP | +--------+---------+------------+-----------+---------+-------+ | 1102 | Bhavesh | 1999-04-07 | rohtak | 86 | 80.56 | | 1108 | pramod | 2007-09-12 | rajsamand | 79 | 80.45 | +--------+---------+------------+-----------+---------+-------+ 2 rows in set (0.00 sec)
mysql> select*from student
-> where name like '__a__'; Empty set (0.00 sec)
mysql> select*from student
-> where name like '__a___'; +--------+--------+------------+-----------+---------+-------+ | Rollno | Name | DOB | city | English | IP | +--------+--------+------------+-----------+---------+-------+ | 1108 | pramod | 2007-09-12 | rajsamand | 79 | 80.45 | +--------+--------+------------+-----------+---------+-------+ 1 row in set (0.00 sec)
mysql> mysql> select RN
-> -> from demo -> -> where IP between 50 and 80; 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 'mysql> select RN -> from demo -> where IP between 50 and 80' at line 1 mysql> +------+ -> | RN | -> +------+ -> | 1 | -> +------+ -> 1 row in set (0.11 sec) -> -> mysql> select*from student -> -> where city in ("jodhpur","jaipur","kota"); 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 '+------+ | RN | +------+ | 1| +------+ 1 row in set (0.11 sec)
mysql> sel' at line 1
mysql> +--------+-----------+------------+---------+---------+-------+ -> | Rollno | Name | DOB | city | English | IP | -> +--------+-----------+------------+---------+---------+-------+ -> | 1101 | Abhishek | 1997-11-23 | jaipur | 91 | 92.95 | -> | 1103 | kapil | 1995-07-09 | kota | 90 | 98.20 | -> | 1107 | Krishna | 2005-09-06 | jodhpur | 89 | 95.00 | -> | 1111 | vidhi | 2007-11-25 | jodhpur | 74 | 86.94 | -> | 1112 | meenakshi | 2008-04-21 | jodhpur | 81 | 95.40 | -> | 1113 | karan | 2007-11-25 | jodhpur | 74 | 35.20 | -> | 1114 | sonu | 2008-03-14 | jodhpur | 29 | 52.20 | -> +--------+-----------+------------+---------+---------+-------+ -> 7 rows in set (0.07 sec) -> -> mysql> select*from student -> -> where city not in ("jodhpur","jaipur","kota"); 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 '+--------+-----------+------------+--------- +---------+-------+ | Rollno | Name ' at line 1 mysql> +--------+---------+------------+-----------+---------+-------+ -> | Rollno | Name | DOB | city | English | IP | -> +--------+---------+------------+-----------+---------+-------+ -> | 1102 | Bhavesh | 1999-04-07 | rohtak | 86 | 80.56 | -> | 1105 | Namit | 2008-01-05 | delhi | 79 | 78.90 | -> | 1106 | sumit | 2006-08-25 | phalodi | 68 | 73.30 | -> | 1108 | pramod | 2007-09-12 | rajsamand | 79 | 80.45 | -> | 1109 | yuvraj | 2010-05-22 | jaisalmer | 65 | 94.02 | -> | 1110 | mukesh | 2009-11-28 | rohat | 57 | 91.48 | -> +--------+---------+------------+-----------+---------+-------+ -> 6 rows in set (0.00 sec) -> -> mysql> select*from student -> -> where name like 'a%'; 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 '+--------+---------+------------+----------- +---------+-------+ | Rollno | Name ' at line 1 mysql> +--------+----------+------------+--------+---------+-------+ -> | Rollno | Name | DOB | city | English | IP | -> +--------+----------+------------+--------+---------+-------+ -> | 1101 | Abhishek | 1997-11-23 | jaipur | 91 | 92.95 | -> +--------+----------+------------+--------+---------+-------+ -> 1 row in set (0.01 sec) -> -> mysql> select*from student -> -> where name like '%a'; 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 '+--------+----------+------------+-------- +---------+-------+ | Rollno | Name ' at line 1 mysql> +--------+---------+------------+---------+---------+-------+ -> | Rollno | Name | DOB | city | English | IP | -> +--------+---------+------------+---------+---------+-------+ -> | 1107 | Krishna | 2005-09-06 | jodhpur | 89 | 95.00 | -> +--------+---------+------------+---------+---------+-------+ -> 1 row in set (0.00 sec) -> -> mysql> select*from student -> -> where name like '__a'; 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 '+--------+---------+------------+--------- +---------+-------+ | Rollno | Name ' at line 1 mysql> Empty set (0.00 sec) -> -> mysql> select*from student -> -> where name like '__a%'; 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 'Empty set (0.00 sec)
mysql> select*from student
-> where name like '__a%'' at line 1 mysql> +--------+---------+------------+-----------+---------+-------+ -> | Rollno | Name | DOB | city | English | IP | -> +--------+---------+------------+-----------+---------+-------+ -> | 1102 | Bhavesh | 1999-04-07 | rohtak | 86 | 80.56 | -> | 1108 | pramod | 2007-09-12 | rajsamand | 79 | 80.45 | -> +--------+---------+------------+-----------+---------+-------+ -> 2 rows in set (0.00 sec) -> -> mysql> select*from student -> -> where name like '__a__'; 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 '+--------+---------+------------+----------- +---------+-------+ | Rollno | Name ' at line 1 mysql> Empty set (0.00 sec) -> -> mysql> select*from student -> -> where name like '__a___'; 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 'Empty set (0.00 sec)
mysql> select*from student
-> where name like '__a___'' at line 1 mysql> +--------+--------+------------+-----------+---------+-------+ -> | Rollno | Name | DOB | city | English | IP | -> +--------+--------+------------+-----------+---------+-------+ -> | 1108 | pramod | 2007-09-12 | rajsamand | 79 | 80.45 | -> +--------+--------+------------+-----------+---------+-------+ -> 1 row in set (0.00 sec