Day Wise Assignment
Day Wise Assignment
Note: -
1. The tables that are mentioned in the questions for the references are available in the
classic model database.
2. In the questions, if they specifically mention to create the tables, then you need to create the
tables as per given specifications.
Day 1
No questions
Day 2
No questions
Day 3x
1) Show customer number, customer name, state and credit limit from customers table for below
conditions. Sort the results by highest to lowest values of creditLimit.
Expected output:
2) xShow the unique productline values containing the word cars at the end from products table.
Expected output:
Day 4
1) xShow the orderNumber, status and comments from orders table for shipped status only. If some
comments are having null values then show them as “-“.
Expected output:
2) xSelect employee number, first name, job title and job title abbreviation from employees table based
on following conditions.
If job title is one among the below conditions, then job title abbreviation column should show below
forms.
● President then “P”
Day 5:
x
1) For every year, find the minimum amount value from payments table.
Expected output:
2) xFor every year and every quarter, find the unique customers and total orders from orders table.
Make sure to show the quarter as Q1,Q2 etc.
Expected output:
3) Show the formatted amount in thousands unit (e.g. 500K, 465K etc.) for every month (e.g. Jan, Feb
etc.) with filter on total amount as 500000 to 1000000. Sort the output by total amount in
descending mode. [ Refer. Payments Table]
Expected output:
Day 6:
● Vendor_ID (Should not contain any duplicates and should not be null)
● Movie_ID (Should not contain any duplicates and should not be null)
a. Product
✔ product_id - primary key
✔ description
b. Suppliers
✔ supplier_id - primary key
✔ supplier_name
✔ location
c. Stock
✔ id - primary key
✔ balance_stock
Day 7
1) Show employee number, Sales Person (combination of first and last names of employees),
unique customers for each employee number and sort the data by highest to lowest unique
customers.
Expected output:
2) Show total quantities, total quantities in stock, left over quantities for each product and each
customer. Sort the data by customer number.
Expected output:
3) Create below tables and fields. (You can add the data as per your wish)
● Laptop: (Laptop_Name)
● Colours: (Colour_Name)
Perform cross join between the two tables and find number of rows.
Expected output:
4) Create table project with below fields.
● EmployeeID
● FullName
● Gender
● ManagerID
Expected output:
Day 8
● Facility_ID
● Name
● State
● Country
i) Alter the table by adding the primary key and auto increment to Facility_ID column.
ii) Add a new column city after name with data type as varchar which should not accept any null
values.
Expected output:
Day 9
● ID
● Name
Remove the spaces from everywhere and update the column like Pune University etc.
Expected output:
Day 10
Create the view products status. Show year wise total products sold. Also find the percentage of total
value for each year. The output should look as shown in below figure.
Expected output:
Day 11
1) Create a stored procedure GetCustomerLevel which takes input as customer number and
gives the output as either Platinum, Gold or Silver as per below criteria.
Table: Customers
2) Create a stored procedure Get_country_payments which takes in year and country as inputs
and gives year wise, country wise total amount as an output. Format the total amount to
nearest thousand unit (K)
Expected output:
Day 12
1) Calculate year wise, month name wise count of orders and year over year (YoY) percentage
change. Format the YoY values in no decimals and show in % sign.
Table: Orders
Expected output:
● Emp_ID
● Name
● DOB
Create a user defined function calculate_age which returns the age in years and months (e.g.
30 years 5 months) by accepting DOB column as a parameter.
Expected output:
Day 13
1) Display the customer numbers and customer names from customers table who have not
placed any orders using subquery
Expected output:
2) Write a full outer join between customers and orders using union and get the customer
number, customer name, count of orders for every customer.
Expected output:
3) Show the second highest quantity ordered value for each order number.
Table: Orderdetails
Expected output:
4) For each order number count the number of products and then find the min and max of the
values among count of orders.
Table: Orderdetails
Expected output:
5) Find out how many product lines are there for which the buy price value is greater than the
average of buy price value. Show the output as product line and its count.
Expected output:
Day 14
● EmpName
● EmailAddress
Create a procedure to accept the values for the columns in Emp_EH. Handle the error using
exception handling concept. Show the message as “Error occurred” in case of anything wrong.
Day 15
● Name
● Occupation
● Working_date
● Working_hours
Create before insert trigger to make sure any new value of Working_hours, if it is negative, then it
should be inserted as positive.