0% found this document useful (0 votes)
10 views2 pages

Exama Paper

Uploaded by

pavanbhavana1609
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Exama Paper

Uploaded by

pavanbhavana1609
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Mock exam

1. DDL: Write a query to create the `Customer` table with columns


`customer_id` (Primary Key), `first_name`, `last_name`, `email`, and
`phone_number`.

2. DDL: Create the `Order` table with columns `order_id` (Primary Key),
`order_date`, `amount`, and `customer_id` (Foreign Key referencing
`Customer`).

3. DML: Write a query to insert a 5 customer into the `Customer` table and
5 orders into the `Order` table

4. DML: Write a query to update the `phone_number` of a specific


customer in the `Customer` table based on `customer_id`.

5. DQL: Write a query to retrieve all `first_name`, `last_name`, and `email`


of customers from the `Customer` table along with their lengths

6. JOIN: Write a query to get each customer’s `first_name`, `last_name`,


and their respective `order_date` from the `Order` table using an inner join.

7. JOIN: Write a query to retrieve all customers from the `Customer` table
along with their orders. If a customer has no orders, display `NULL` for the
order details using a left join.

8. Subquery: Write a query to find customers who have not placed any
orders by checking for customers not in the `Order` table.

9. Subquery: Write a query to retrieve order_id and amount for orders that
have an amount greater than the overall average order amount.

10. Aggregation: Write a query to count the number of unique customers


who have placed at least one order and also max and min order amount

You might also like