ITDA1001 Database Fundamentals Tutorial – 6 |
March 2022 |
ITDA1001 Lab Tutorial 6
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