Professional Documents
Culture Documents
Create a new database called "e-commerce" with the following tables and
insert 6 rows for each table.
Task:
1. Add a new column "age" to the "customers" table with the
data type "int".
2. Rename the "orders" table to "customer_orders".
3. Delete the "products" table.
4. Insert the following information into the "customers" table:
Name: John Smith, Age: 25, Email: john.smith@email.com, Phone:
555-1234, Address: 123 Main St, Anytown USA
5. Write a SQL statement to retrieve the name and email of all customers from
the "customers" table.
6. Write a SQL statement to update the email of customer with id = 2 to
"sarah.johnson123@email.com".
7. Delete all customers whose age is less than 18.
8. List the customer name who’s name starting with the letter ‘S’.
2. Create the following tables and insert 5 rows for each tables then write
the queries.
Task:
1. List the students as per their alphabetic order
2. List the Subjects ID in Descending order
3. List the students who has enroll for DBMS.
4. Write a query to find the average grade of particular subject.
5. Alter the Teacher table and add Phone number.
6. Find the student who has opted for ‘DBMS’ and ‘FCC’ and has an
avg grade of 7.5.
7. List the student name who’s name starting with the letter ‘S’.
8. Display the rows with not null Values.
3.
VALUES
(1, 'New York', '2022-01-01', 32, 'Snow', 4.5),
(2, 'London', '2022-01-02', 40, 'Rain', 0.8),
(3, 'Tokyo', '2022-01-03', 50, 'Sunny', 0),
(4, 'Beijing', '2022-01-04', 20, 'Snow', 6.2),
(5, 'Sydney', '2022-01-05', 70, 'Sunny', 0),
(6, 'Paris', '2022-01-06', 30, 'Rain', 2.5),
(7, 'Berlin', '2022-01-07', 25, 'Snow', 5),
(8, 'Toronto', '2022-01-08', 20, 'Snow', 7.8),
(9, 'Moscow', '2022-01-09', 10, 'Snow', 9.5),
(10, 'Rome', '2022-01-10', 45, 'Rain', 3.2);
TASK: DATA MANIPULATION