Professional Documents
Culture Documents
CS403P Assignment
CS403P Assignment
CS403P Assignment
02
SEMESTER Spring 2022
CS403P- Database Management Systems (Practical)
Question 1: Marks = 10
Consider the following relation and write the SQL commands for the following tasks:
Customer:
Order:
Solution:
1. Retrieve Customer Name from customer table whose customer name start with like
“Dr”
Solution:
SELECT * FROM Customer
WHERE CustomerName LIKE 'Dr%';
SELECT COUNT(CustomerID), Province
FROM Customers
GROUP BY Province
ORDER BY COUNT(CustomerID) DESC;
3. Write SQL query to display Customer name whose order size is maximum.
Solution:
5. Using self join write SQL statement matches customer that are from the same
province.
Solution:
SELECT A.CustomerName AS CustomerName1,
B.CustomerName AS CustomerName2, A.Province
FROM Customers A, Customers B
WHERE A.CustomerID <> B.CustomerID
AND A.Province = B.Province
ORDER BY A.Province;