0% found this document useful (0 votes)
38 views1 page

SQL Questions

Create database tables as required and insert dummy data. Write queries to: 1) Display order details with product list and merchant name. 2) Find usernames starting with "Ni" and ending with "Vi" containing "iv". 3) Show role, username and user order details. 4) Calculate differences between users' order dates and totals. 5) Count total orders per user. 6) Count orders per user in a month. 7) List orders under $500. 8) Create stored procedure to report total order value by merchant. 9) Create function to report total order value by user ID. 10) Create view to list all product

Uploaded by

Hari Haran
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
38 views1 page

SQL Questions

Create database tables as required and insert dummy data. Write queries to: 1) Display order details with product list and merchant name. 2) Find usernames starting with "Ni" and ending with "Vi" containing "iv". 3) Show role, username and user order details. 4) Calculate differences between users' order dates and totals. 5) Count total orders per user. 6) Count orders per user in a month. 7) List orders under $500. 8) Create stored procedure to report total order value by merchant. 9) Create function to report total order value by user ID. 10) Create view to list all product

Uploaded by

Hari Haran
Copyright
© © All Rights Reserved
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/ 1

Create a database and tables as per the given requirement(Insert dummy data to play)

Questions:

1. Write a query to display OrderId, product list, and the merchant name.

2. Write a query to display the username startswith 'Ni' and endswith 'Vi' and contains 'iv'.

3. Write a query to display the rolename, username, and user order details.

4. Write a query to find the difference between the user's first order and the user's last order and also

the user's first order and the user's second order and also when the user placed the last order date.

5. Write a query to display how many order's user placed in totally.

6. Write a query to display how many order's user placed totally in one month.

7. Write a query to diplay only the order's total value less than 500.

8. Create a Stored Procedure display all the merchant's total order value(Output - Merchant Name, Total
Order Value).

9. Create a function to display particular user's total order(Functions parameter - user_Id).

10. Create a view to get all the product names.

You might also like