0% found this document useful (0 votes)
22 views4 pages

DBMS Cat 2

This document contains 14 questions about SQL queries on salesman and orders tables. Each question provides an SQL query to retrieve specific columns, rows, or values based on conditions like city, commission amount, salesman ID, order date, purchase amount, etc. The last question simply selects a hardcoded string for output.

Uploaded by

jeff
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views4 pages

DBMS Cat 2

This document contains 14 questions about SQL queries on salesman and orders tables. Each question provides an SQL query to retrieve specific columns, rows, or values based on conditions like city, commission amount, salesman ID, order date, purchase amount, etc. The last question simply selects a hardcoded string for output.

Uploaded by

jeff
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

jeff omondi munga

SCT121-C002-0013/2021

DIPLOMA IN INFORMATION TECHNOLOGY

DIT0201: INTRODUCTION TO DATABASE


MANAGEMENT SYSTEMS

PURPOSE: To understand the basics of Database


Management and its SQL statements.

ASSIGNMENT TWO
Question One
Being that the table contains Salesman information, we’ll name the table as “salesman”.
An SQL statement to display all the information of all salesmen.
SELECT * FROM salesman;

Question Two
An SQL statement to display specific columns like name and commission for all the salesmen.
SELECT name, commission
FROM salesman;

Question Three
An SQL statement to display names and city of salesman, who belongs to the city of Paris.
SELECT name,city
FROM salesman
WHERE city='Paris';
Question Four

An SQL statement to find those salesmen with all information who come from the city either
Paris or Rome.
SELECT * FROM salesman
WHERE city='Paris' OR city='Rome';

Question Five
Write a query to filter those salesmen with all information who comes from any of the cities
Paris and Rome.
SELECT * FROM salesman
WHERE city IN('Paris','Rome');

Question Six
Write a query to produce a list of salesman_id, name, city and commission of each salesman who
live in cities other than Paris and Rome.
SELECT * FROM salesman
WHERE city NOT IN('Paris','Rome');
Question Seven
Write a SQL statement to find those salesmen with all information who gets the commission
within a range of 0.12 and 0.14.
SELECT * FROM salesman
WHERE commission BETWEEN 0.12 AND 0.14;

Question Eight
Write a SQL statement to find those salesmen with all other information and name started with
any letter within 'A' and 'K'.
SELECT * FROM salesman
WHERE name BETWEEN 'A' and 'K';

Question Nine
Write a SQL statement to find those salesmen with all other information and name started with
other than any letter within 'A' and 'L'.
SELECT * FROM salesman
WHERE name BETWEEN 'A' and 'L';

Question Ten
Being that the table contains Order information, we’ll name the table as “Orders”.
Write a query to display the columns in a specific order like order date, salesman id, order
number and purchase amount from for all the orders.
SELECT ord_date, salesman_id, ord_no, purch_amt
FROM orders;

Question Eleven
Write a query which will retrieve the value of salesman id of all salesmen, getting orders from
the customers in orders table without any repeats.
SELECT DISTINCT salesman_id
FROM orders;
Question Twelve
Write a SQL query to display the order number followed by order date and the purchase amount
for each order which will be delivered by the salesman who is holding the ID 5001.
SELECT ord_no, ord_date, purch_amt
FROM orders
WHERE salesman_id = 5001;

Question Thirteen
Write a query to filter all those orders with all information which purchase amount value is
within the range 500 and 4000 except those orders of purchase amount value 948.50 and
1983.43.
SELECT *
FROM orders
WHERE (purch_amt BETWEEN 500 AND 4000)
AND NOT purch_amt IN(948.50,1983.43);

Question Fourteen
Write a SQL statement to display a string "This is SQL Exercise, Practice and Solution".
SELECT 'This is SQL Exercise, Practice and Solution';

You might also like