DB
DB
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> INSERT INTO Customers (first_name, last_name, email, address, city, state,
zip_code)
-> VALUES
-> ('Rahul', 'Kumar', '[email protected]', '123 Main St', 'Mumbai', 'MH',
'400001'),
-> ('Priya', 'Sharma', '[email protected]', '456 Park Ave', 'Delhi', 'DL',
'110001'),
-> ('Rajesh', 'Patel', '[email protected]', '789 Oak Rd', 'Ahmedabad',
'GJ', '380001'),
-> ('Sanya', 'Gupta', '[email protected]', '101 Pine Dr', 'Bangalore',
'KA', '560001'),
-> ('Manish', 'Singh', '[email protected]', '555 Cedar Ln', 'Kolkata',
'WB', '700001'),
-> ('Neha', 'Desai', '[email protected]', '888 Maple Blvd', 'Chennai', 'TN',
'600001'),
-> ('Ravi', 'Verma', '[email protected]', '333 Elm St', 'Hyderabad', 'TS',
'500001'),
-> ('Anjali', 'Reddy', '[email protected]', '222 Birch Ave', 'Pune', 'MH',
'411001'),
-> ('Rohit', 'Choudhury', '[email protected]', '777 Oak Rd', 'Jaipur',
'RJ', '302001');
Query OK, 9 rows affected (0.00 sec)
Records: 9 Duplicates: 0 Warnings: 0
mysql> select * from Customers where customer_id = (select Customer_id from Orders
where order_id = (select Order_id from Order_items where product_id = 1));
+-------------+------------+-----------+----------------------+-------------
+---------+-------+----------+
| customer_id | first_name | last_name | email | address | city
| state | zip_code |
+-------------+------------+-----------+----------------------+-------------
+---------+-------+----------+
| 1 | John | Doe | [email protected] | 123 Main St |
Anytown | CA | 570069 |
+-------------+------------+-----------+----------------------+-------------
+---------+-------+----------+
1 row in set (0.00 sec)