The document outlines SQL assignments involving the creation of two tables: employee_salaries and orders, along with sample data insertion. It includes a series of queries to manipulate and retrieve data, such as calculating salaries, filtering orders, and analyzing sales. The queries cover various SQL functions and operations to demonstrate data handling and reporting capabilities.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views2 pages
Assignment On SQL Functions
The document outlines SQL assignments involving the creation of two tables: employee_salaries and orders, along with sample data insertion. It includes a series of queries to manipulate and retrieve data, such as calculating salaries, filtering orders, and analyzing sales. The queries cover various SQL functions and operations to demonstrate data handling and reporting capabilities.
1. Concatenate first and last names as fullname from a table employee_Salaries table. 2.Calculate average, maximum, and rounded salary from an employee_salaries table. 3.Filter records in orders table between '2024-01-01' and '2024-12-31': 4. Write a query to retrieve all orders that are currently in "Processing" status. 5. Write a query to calculate the total sales (total_amount) for each month in 2024. 6.Write a query to find the average total_amount of all completed orders (status "Delivered"). 7.Write a query to find the highest and lowest total_amount orders from the orders table. 8.Write a query to find all orders where the total_amount is greater than $500. 9.Write a query to display the count of orders for each order_status. 10.Write a query to list the top 3 most ordered products based on the quantity ordered. 11. Write a query to find the customer_ids of customers who have placed more than one order. 12. Write a query to calculate the total revenue generated by each product (product_name). 13.Write a query to list all orders placed between '2024-03-01' and '2024-06-30'. 14.Write a query to find the first and last order date for each customer. 15.Assuming a 7% sales tax, write a query to calculate the sales tax and total amount including tax for each order. 16.Write a query to display the number of orders placed each month in 2024. 17.Write a query to extract the month and year from the order_date and format it as "Month YYYY" (e.g., "January 2024"). 18.Write a query to calculate the cumulative sales (total_amount) for all orders sorted by order_date. 19.Write a query to find all orders that contain the word "Laptop" in the product_name. 20.Assume orders over $1000 have a 10% discount. Write a query to calculate the discounted price for such orders. 21.Write a query to group orders by quarter and show the total sales in each quarter. 22.Write a query to list all orders for a customer with customer_id = 105, including the order details and total amount.