Quret-1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| restaurantdb |
| sakila |
| sys |
| world |
+--------------------+
7 rows in set (0.01 sec)
mysql> USE RestaurantDB;
Database changed
Query-2
mysql> show tables;
+------------------------+
| Tables_in_restaurantdb |
+------------------------+
| customers |
| employees |
| menu |
| order_details |
| orders |
+------------------------+
5 rows in set (0.00 sec)
Query-3
mysql> show customers;
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
'customers' at line 1
mysql> show table customers;
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
'customers' at line 1
Query-4
mysql> select * from customers;
+-------------+------------+-----------+--------------------+----------------
+-------------+
| customer_id | first_name | last_name | email | contact_number |
address |
+-------------+------------+-----------+--------------------+----------------
+-------------+
| 1 | Rashid | Islam |
[email protected] | 01810000001 |
Dhaka |
| 2 | Shamim | Akter |
[email protected] | 01810000002 |
Chittagong |
| 3 | Tania | Sultana |
[email protected] | 01810000003 |
Sylhet |
| 4 | Fariha | Ahmed |
[email protected] | 01810000004 |
Barisal |
| 5 | Hossain | Chowdhury |
[email protected] | 01810000005 |
Rajshahi |
| 6 | Mokhles | Ali |
[email protected] | 01810000006 |
Khulna |
| 7 | Nabila | Islam |
[email protected] | 01810000007 |
Jessore |
| 8 | Shafiqul | Islam |
[email protected] | 01810000008 |
Comilla |
| 9 | Akter | Khan |
[email protected] | 01810000009 |
Mymensingh |
| 10 | Mehedi | Hasan |
[email protected] | 01810000010 |
Rajshahi |
| 11 | Lamia | Karim |
[email protected] | 01810000011 |
Narayanganj |
| 12 | Amin | Zaman |
[email protected] | 01810000012 |
Khulna |
| 13 | Rehana | Begum |
[email protected] | 01810000013 |
Cox's Bazar |
| 14 | Mushfiq | Rahman |
[email protected] | 01810000014 |
Pabna |
| 15 | Sadia | Khan |
[email protected] | 01810000015 |
Shariatpur |
| 16 | Hasan | Ali |
[email protected] | 01810000016 |
Faridpur |
| 17 | Riya | Sultana |
[email protected] | 01810000017 |
Manikganj |
| 18 | Khalid | Rahman |
[email protected] | 01810000018 |
Madaripur |
| 19 | Asma | Akter |
[email protected] | 01810000019 |
Gazipur |
| 20 | Arif | Siddique |
[email protected] | 01810000020 |
Meherpur |
+-------------+------------+-----------+--------------------+----------------
+-------------+
20 rows in set (0.00 sec)
Query-5
mysql> UPDATE customers
-> SET address = 'Dhaka'
-> WHERE first_name = 'Tania' AND last_name = 'Sultana';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Query-6
mysql> select * from customers;
+-------------+------------+-----------+--------------------+----------------
+-------------+
| customer_id | first_name | last_name | email | contact_number |
address |
+-------------+------------+-----------+--------------------+----------------
+-------------+
| 1 | Rashid | Islam | [email protected] | 01810000001 |
Dhaka |
| 2 | Shamim | Akter | [email protected] | 01810000002 |
Chittagong |
| 3 | Tania | Sultana | [email protected] | 01810000003 |
Dhaka |
| 4 | Fariha | Ahmed | [email protected] | 01810000004 |
Barisal |
| 5 | Hossain | Chowdhury | [email protected] | 01810000005 |
Rajshahi |
| 6 | Mokhles | Ali | [email protected] | 01810000006 |
Khulna |
| 7 | Nabila | Islam | [email protected] | 01810000007 |
Jessore |
| 8 | Shafiqul | Islam | [email protected] | 01810000008 |
Comilla |
| 9 | Akter | Khan | [email protected] | 01810000009 |
Mymensingh |
| 10 | Mehedi | Hasan | [email protected] | 01810000010 |
Rajshahi |
| 11 | Lamia | Karim | [email protected] | 01810000011 |
Narayanganj |
| 12 | Amin | Zaman | [email protected] | 01810000012 |
Khulna |
| 13 | Rehana | Begum | [email protected] | 01810000013 |
Cox's Bazar |
| 14 | Mushfiq | Rahman | [email protected] | 01810000014 |
Pabna |
| 15 | Sadia | Khan | [email protected] | 01810000015 |
Shariatpur |
| 16 | Hasan | Ali | [email protected] | 01810000016 |
Faridpur |
| 17 | Riya | Sultana | [email protected] | 01810000017 |
Manikganj |
| 18 | Khalid | Rahman | [email protected] | 01810000018 |
Madaripur |
| 19 | Asma | Akter | [email protected] | 01810000019 |
Gazipur |
| 20 | Arif | Siddique | [email protected] | 01810000020 |
Meherpur |
+-------------+------------+-----------+--------------------+----------------
+-------------+
20 rows in set (0.00 sec)
Query-7
mysql> DELETE FROM customers WHERE customer_id = 5;
Query OK, 1 row affected (0.01 sec)
Query-8
mysql> select * from customers;
+-------------+------------+-----------+--------------------+----------------
+-------------+
| customer_id | first_name | last_name | email | contact_number |
address |
+-------------+------------+-----------+--------------------+----------------
+-------------+
| 1 | Rashid | Islam | [email protected] | 01810000001 |
Dhaka |
| 2 | Shamim | Akter | [email protected] | 01810000002 |
Chittagong |
| 3 | Tania | Sultana | [email protected] | 01810000003 |
Dhaka |
| 4 | Fariha | Ahmed | [email protected] | 01810000004 |
Barisal |
| 6 | Mokhles | Ali | [email protected] | 01810000006 |
Khulna |
| 7 | Nabila | Islam | [email protected] | 01810000007 |
Jessore |
| 8 | Shafiqul | Islam | [email protected] | 01810000008 |
Comilla |
| 9 | Akter | Khan | [email protected] | 01810000009 |
Mymensingh |
| 10 | Mehedi | Hasan | [email protected] | 01810000010 |
Rajshahi |
| 11 | Lamia | Karim | [email protected] | 01810000011 |
Narayanganj |
| 12 | Amin | Zaman | [email protected] | 01810000012 |
Khulna |
| 13 | Rehana | Begum | [email protected] | 01810000013 |
Cox's Bazar |
| 14 | Mushfiq | Rahman | [email protected] | 01810000014 |
Pabna |
| 15 | Sadia | Khan | [email protected] | 01810000015 |
Shariatpur |
| 16 | Hasan | Ali | [email protected] | 01810000016 |
Faridpur |
| 17 | Riya | Sultana | [email protected] | 01810000017 |
Manikganj |
| 18 | Khalid | Rahman | [email protected] | 01810000018 |
Madaripur |
| 19 | Asma | Akter | [email protected] | 01810000019 |
Gazipur |
| 20 | Arif | Siddique | [email protected] | 01810000020 |
Meherpur |
+-------------+------------+-----------+--------------------+----------------
+-------------+
19 rows in set (0.00 sec)
Query-9
mysql> DELETE FROM customers WHERE last_name = 'Ali';
Query OK, 2 rows affected (0.00 sec)
Query-10
mysql> select * from customers;
+-------------+------------+-----------+--------------------+----------------
+-------------+
| customer_id | first_name | last_name | email | contact_number |
address |
+-------------+------------+-----------+--------------------+----------------
+-------------+
| 1 | Rashid | Islam | [email protected] | 01810000001 |
Dhaka |
| 2 | Shamim | Akter | [email protected] | 01810000002 |
Chittagong |
| 3 | Tania | Sultana | [email protected] | 01810000003 |
Dhaka |
| 4 | Fariha | Ahmed | [email protected] | 01810000004 |
Barisal |
| 7 | Nabila | Islam | [email protected] | 01810000007 |
Jessore |
| 8 | Shafiqul | Islam | [email protected] | 01810000008 |
Comilla |
| 9 | Akter | Khan | [email protected] | 01810000009 |
Mymensingh |
| 10 | Mehedi | Hasan | [email protected] | 01810000010 |
Rajshahi |
| 11 | Lamia | Karim | [email protected] | 01810000011 |
Narayanganj |
| 12 | Amin | Zaman | [email protected] | 01810000012 |
Khulna |
| 13 | Rehana | Begum | [email protected] | 01810000013 |
Cox's Bazar |
| 14 | Mushfiq | Rahman | [email protected] | 01810000014 |
Pabna |
| 15 | Sadia | Khan | [email protected] | 01810000015 |
Shariatpur |
| 17 | Riya | Sultana | [email protected] | 01810000017 |
Manikganj |
| 18 | Khalid | Rahman | [email protected] | 01810000018 |
Madaripur |
| 19 | Asma | Akter | [email protected] | 01810000019 |
Gazipur |
| 20 | Arif | Siddique | [email protected] | 01810000020 |
Meherpur |
+-------------+------------+-----------+--------------------+----------------
+-------------+
17 rows in set (0.00 sec)
Query-11
mysql> SELECT * FROM customers
-> WHERE address IN ('Dhaka', 'Chittagong', 'Sylhet');
+-------------+------------+-----------+------------------+----------------
+------------+
| customer_id | first_name | last_name | email | contact_number |
address |
+-------------+------------+-----------+------------------+----------------
+------------+
| 1 | Rashid | Islam | [email protected] | 01810000001 | Dhaka
|
| 2 | Shamim | Akter | [email protected] | 01810000002 |
Chittagong |
| 3 | Tania | Sultana | [email protected] | 01810000003 | Dhaka
|
+-------------+------------+-----------+------------------+----------------
+------------+
3 rows in set (0.00 sec)
Query-12
mysql> SELECT * FROM customers
-> WHERE address NOT IN ('Dhaka', 'Khulna');
+-------------+------------+-----------+--------------------+----------------
+-------------+
| customer_id | first_name | last_name | email | contact_number |
address |
+-------------+------------+-----------+--------------------+----------------
+-------------+
| 2 | Shamim | Akter | [email protected] | 01810000002 |
Chittagong |
| 4 | Fariha | Ahmed | [email protected] | 01810000004 |
Barisal |
| 7 | Nabila | Islam | [email protected] | 01810000007 |
Jessore |
| 8 | Shafiqul | Islam | [email protected] | 01810000008 |
Comilla |
| 9 | Akter | Khan | [email protected] | 01810000009 |
Mymensingh |
| 10 | Mehedi | Hasan | [email protected] | 01810000010 |
Rajshahi |
| 11 | Lamia | Karim | [email protected] | 01810000011 |
Narayanganj |
| 13 | Rehana | Begum | [email protected] | 01810000013 |
Cox's Bazar |
| 14 | Mushfiq | Rahman | [email protected] | 01810000014 |
Pabna |
| 15 | Sadia | Khan | [email protected] | 01810000015 |
Shariatpur |
| 17 | Riya | Sultana | [email protected] | 01810000017 |
Manikganj |
| 18 | Khalid | Rahman | [email protected] | 01810000018 |
Madaripur |
| 19 | Asma | Akter | [email protected] | 01810000019 |
Gazipur |
| 20 | Arif | Siddique | [email protected] | 01810000020 |
Meherpur |
+-------------+------------+-----------+--------------------+----------------
+-------------+
14 rows in set (0.00 sec)