0% found this document useful (0 votes)
136 views

Principles of Database Systems Lab Cycle PDF

The document describes a lab assignment involving creating and querying a General Hardware Database (GHD). The GHD contains tables for salespersons, customers, customer employees, products, and sales. Students are asked to create and populate the GHD, then write and execute queries to answer 20 questions involving finding salesperson details, customer details, product sales details, and identifying minimum/maximum values.

Uploaded by

Vamsi Krishna
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)
136 views

Principles of Database Systems Lab Cycle PDF

The document describes a lab assignment involving creating and querying a General Hardware Database (GHD). The GHD contains tables for salespersons, customers, customer employees, products, and sales. Students are asked to create and populate the GHD, then write and execute queries to answer 20 questions involving finding salesperson details, customer details, product sales details, and identifying minimum/maximum values.

Uploaded by

Vamsi Krishna
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/ 2

Principles of Database Systems

Lab Cycle-I (SQL)

Assignments:

1. Creation of General Hardware Database (GHD), Insertion of data into GHD and
writing and executing queries for the questions 1-5.
2. Writing and executing queries for the questions 6-20.

I. General Hardware Database:

Sales_Person(SalesPersonNumber, SalesPersonName, CommPercentage, YearHire,


OfficeNumber)
Customer(CustomerNumber, CustomerName, SalesPersonNumber, HeadQuarterCity)
Customer_Employee(CustomerNumber, EmployeeNumber, EmployeeName, Title)
Product(ProductNumber, ProductName, UnitPrice)
Sales(SalesPersonNumber, ProductNumber, Quantity)
Office(OfficeNumber, Telephone, Size)

Answer the following queries


1. Find the commission percentage and year of hire of salesperson number 186.
2. List the salesperson numbers and salesperson names of those salespersons who have a
commission percentage of 10.
3. List the salesperson number and salesperson name of all of the salespersons.
4. List the salesperson numbers, salesperson names, and commission percentages of the
salespersons whose commission percentage is less than 12.
5. List the customer numbers and headquarters cities of the customers that have a customer
number of at least 1700.
6. List the customer numbers, customer names, and headquarters cities of the customers
that are headquartered in New York and that have a customer number higher than 1500.
7. ‘List the customer numbers, customer names, and headquarters cities of the customers
that are headquartered in New York or that have a customer number higher than 1500.
8. List the customer numbers, customer names, and headquarters cities of the customers
that are headquartered in New York or that satisfy the two conditions of having a
customer number higher than 1500 and being headquartered in Atlanta.
9. Which cities serve as headquarters cities for General Hardware customers?
10. Find the customer numbers, customer names, and headquarters cities of those customers
with customer numbers greater than 1000. List the results in alphabetic order by
headquarters cities.
11. Find the average number of units of the different products that Salesperson 137 sold
(i.e., the average of the quantity values in the first three records of the SALES table).
12. What is the largest number of units of Product Number 21765 that any individual
salesperson has sold?
13. How many salespersons have sold Product Number 21765?
14. Find the total number of units of all products sold by each salesperson.
15. Find the total number of units of all products sold by each salesperson whose
salesperson number is at least 150.
16. Find the total number of units of all products sold by each salesperson whose
salesperson number is at least 150.
17. Find the total number of units of all products sold by each salesperson whose
salesperson number is at least 150. Include only salespersons whose total number of
units sold is at least 5000.
18. Find the name of the salesperson responsible for Customer Number 1525.
19. List the names of the products of which salesperson Adams has sold more than 2000
units.
20. Which salespersons with salesperson numbers greater than 200 have the lowest
commission percentage?’’ (We’ll identify salespersons by their salesperson number.)

You might also like