0% found this document useful (0 votes)
23 views3 pages

National University: Name: Roll No: Section: Quiz No. 2 Database System Date: Duration: 45 Minute(s)

This document contains a quiz on database systems with 13 multiple choice questions. The questions test SQL skills like retrieving data from tables, filtering on conditions, sorting results, aggregation, and joins. The questions reference tables for employees, salesmen, orders, and customers. Students are asked to write SQL statements to select, filter, sort, group, and join data between the tables.
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)
23 views3 pages

National University: Name: Roll No: Section: Quiz No. 2 Database System Date: Duration: 45 Minute(s)

This document contains a quiz on database systems with 13 multiple choice questions. The questions test SQL skills like retrieving data from tables, filtering on conditions, sorting results, aggregation, and joins. The questions reference tables for employees, salesmen, orders, and customers. Students are asked to write SQL statements to select, filter, sort, group, and join data between the tables.
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/ 3

National University

Of Computer & Emerging Sciences Faisalabad -Chiniot Campus

Name: Roll No: Section:


Quiz No. 2 Database System Date:
Duration: 45 Minute(s)

Question#1:
Retrieve Employee City, Employee ID, First Name, Last Name from Table sorted by city name
(Descending)?
Select city,EmployeeId,FirstName,LastName from employee order by city DESC;
Question#2:
Retrieve number of Employee group by their cities?
Select count(*),city from employee group by City;
Question#3:
Show First name, Last name and City of Employees who are hired after ‘1/1/1993’ or live in
Kikland?
Select FirstName,LastName,City from employee where HireDate>'1/1/1993' or
city='Kirkland';
Question#4:
Find all of the employees whose first name does not start with 'M' or 'A'
Select * from employee where FirstName not like 'M%' and FirstName not like 'A%';

SALESMAN

1
National University
Of Computer & Emerging Sciences Faisalabad -Chiniot Campus

Question#5
Write a SQL statement to display list of names of all salesman in sorted form w.r.t their
commission?
Select name from SALESMAN order by commission;
Question#6
Write a SQL statement to salesman id and name of all salesmen whose Commission is between
0.12 to 0.14
select salesman_id,name from SALESMAN where commission between 0.12 and 0.14;
Question#7
Write a SQL statement to display name and City of all salesmen whose Commission is greater
than 0.13 or their names end with ‘e’ or ‘x’
select name,city from SALESMAN where commission>0.13 or name Like '%e' or name like '%x';
Question#8
Write SQL statement to List the number of salesman in each city. Only include salesman with commission
more than 0.12.
select count(*),city from SALESMAN where commission>0.12 group by city ;

Orders

Question#9
Write a SQL statement to display List the amount of orders in ascending order.

2
National University
Of Computer & Emerging Sciences Faisalabad -Chiniot Campus

Select purch_amt from Orders order by purch_amt;

Question#10
Write a SQL statement to display order number, amount and date of all orders that are placed
before 1-sept-2012.
Select ord_no,purch_amt,ord_date from Orders where ord_date<'2012-09-01';

CUSTOMER

Question#11
Write a SQL statement to display all the information for those customers sorted by their city.

Select * from CUSTOMER order by city;


Question#12
Write a SQL statement to display total number of customers in each city having grades between
100 to 200.
Select count(*),city from CUSTOMER where grade between 100 and 200 group by city;
Question#13
Write a SQL statement to display List the number of customers in each city, except the
‘Paris,.

select count(*),city from CUSTOMER where grade between 100 and 200 and city!='Paris'
group by city;

You might also like