Recent Question/Assignment

ITDA1001
Database Fundamentals
Tutorial - 5
March 2022
Task 1: Using Northwind Database, write SQL statements for the following data retrieval operations.
Note: You may need to refer to the schema for the exact field names while framing the queries to the following questions. While framing the question, the words ‘code’, ‘number’ or ‘ID’ may have been synonymously used. For instance, ‘Customer Number’ when used may refer to a field called CustomerID. Similarly, wherever the word ‘name’ is used, appropriate interpretation may be needed based on the schema – for instance if ‘customer name’ is required to be printed, you may need to retrieve CompanyName field from the Customers Table; likewise, when ‘employee name’ is required (without any further qualification, you may retrieve the lastname field of Employees table.
Exercise
5.1 List all details of all Shippers that the company is dealing with.
5.2 List the all employees - you need to display only the details of their First Name, Last Name, Title, Date of birth and their city of residence.
5.3 Extract the information of employees having title (designation) as Sales Representative.
5.4 Retrieve the details of all orders made on 19 May 1997.
5.5 Retrieve details of all customers that are in the cities of London or Madrid.
5.6 Display all unique City from customer’s table.
5.7 Display details of Products having unitprice in range of 100 to 200.
5.8 Display details of Products which unitprices are below 100 and above 200.
5.9 Display details of 'Ernst Handel' Customers
5.10 Display details of all Employees residing in USA or UK.
Copyright © 2022 VIT, All Rights Reserved. 2
ITDA1001
Database Fundamentals
Tutorial - 6
March 2022
Task 1: Using Northwind Database, write SQL statements for the following data retrieval operations.
Note: You may need to refer to the schema for the exact field names while framing the queries to the following questions. While framing the question, the words ‘code’, ‘number’ or ‘ID’ may have been synonymously used. For instance, ‘Customer Number’ when used may refer to a field called CustomerID. Similarly, wherever the word ‘name’ is used, appropriate interpretation may be needed based on the schema – for instance if ‘customer name’ is required to be printed, you may need to retrieve CompanyName field from the Customers Table; likewise, when ‘employee name’ is required (without any further qualification, you may retrieve the lastname field of Employees table.
Exercise
6.1 List all details of Customers with the output presented in descending order of Company names.
6.2 Use Alias for each few columns of Customers and display Customers details.
6.3 Using “BETWEEN” Display product details having inventory of more than 100 and less than 120.
6.4 Display all details of customers having contact name starting with letter ‘r’ or ending with ‘er’
6.5 Display the list of products that should be re-order.
6.6 List out only 5 percentage of total records from customers table.
6.7 Retrieve the Customer IDs and contact names of all customers who have yet to order any products.
6.8 Display product details which are ordered atleast once and having inventory of more than 100
6.9 List CustomerID and Company Name, those had orders in past having shipment postal code 50739.
6.10 Retrieve the details of all Products’ having the word “lager” in the product label.
6.11 List all Orders (Order number and date) of the orders made by the Customer “Thomas Hardy”. Note: Thomas Hardy is the name of the contact person.
Copyright © 2022 VIT, All Rights Reserved. 2
ITDA1001
Database Fundamentals
Tutorial - 7
March 2022
Task 1: Using Northwind Database, write SQL statements for the following data retrieval operations.
Note: You may need to refer to the schema for the exact field names while framing the queries to the following questions. While framing the question, the words ‘code’, ‘number’ or ‘ID’ may have been synonymously used. For instance, ‘Customer Number’ when used may refer to a field called CustomerID. Similarly, wherever the word ‘name’ is used, appropriate interpretation may be needed based on the schema – for instance if ‘customer name’ is required to be printed, you may need to retrieve CompanyName field from the Customers Table; likewise, when ‘employee name’ is required (without any further qualification, you may retrieve the lastname field of Employees table.
Exercise
7.1 Retrieve the IDs and company names of all customers that have made more than 10 orders.
7.2 Retrieve all details of Orders administered by persons who hold the designation Sales Representative and shipped by United Package.
7.3 Select the IDs and contact names of customers that have more orders than customer ‘BONAP’.
7.4 Retrieve the names of all employee. For each employee list the name of his/her manager in adjacent columns.
7.5 Find out all the orders placed by all the customers.
7.6 Find out all the Orders processed by each Employee.
7.7 Display all customers details (who have placed orders and who have not placed orders) and orders details which are placed by customers.
7.8 Find out all the customers and their orders and filter the result on customer's city (London).
7.9 Display all customers details (who have placed orders) and orders details which are placed by customers.
Copyright © 2022 VIT, All Rights Reserved. 2

ITDA1001
Database Fundamentals
Tutorial - 8
March 2022
Task 1: Using Northwind Database, write SQL statements for the following data retrieval operations.
Note: You may need to refer to the schema for the exact field names while framing the queries to the following questions. While framing the question, the words ‘code’, ‘number’ or ‘ID’ may have been synonymously used. For instance, ‘Customer Number’ when used may refer to a field called CustomerID. Similarly, wherever the word ‘name’ is used, appropriate interpretation may be needed based on the schema – for instance if ‘customer name’ is required to be printed, you may need to retrieve CompanyName field from the Customers Table; likewise, when ‘employee name’ is required (without any further qualification, you may retrieve the lastname field of Employees table.
Excercise
8.1 Retrieve the first three letters of the employees' last names.
8.2 Retrieve the last two characters from the employees' last names.
8.3 Retrieve five characters from the employees' last names, starting at the second character.
8.4 Retrieve the firstname and lastname of employee. Output should be in the form of full name (firstname + ““ + lastname) having first character in upper case for both firstname and lastname, and other characters in lower case.
8.5 Retrieve maximum, minimum and average of unitprice column from order details table.
8.6 Check whether each value in the PostalCode column of the Customers table are numeric or not.
8.7 Display the Day, Month and Year separetly of today’s date.
8.8 Display day of year, day, week, weekday, hours, minutes and seconds of current day.
8.9 Display the dates respectively after adding 4 years, 2 months and 25 days to the current.
8.10 Display the day differences from Orders table between following:
a. Order date and required date.
b. Order date and shipped date.
c. Shipped date and required date.
Copyright © 2022 VIT, All Rights Reserved. 2