Professional Documents
Culture Documents
DB 12
DB 12
Section B
Lab Report # 12
Muhammad Jahangir 21-CS-089
Basit Ali 21-CS-104
Muhammad Alrayan 21-CS-107
Inserting Data
Result
Inserting Data
Results
Task 1
From the following tables, write a SQL query to find all the orders issued by the salesman 'Paul
Adam'. Return ord_no, purch_amt, ord_date, customer_id and salesman_id.
Result
Task2
From the following tables write a SQL query to find all orders generated by London-based
salespeople. Return ord_no, purch_amt, ord_date, customer_id, salesman_id.
Result
Conclusion:
1. Orders by Salesmen in London:
The SQL query skillfully utilizes a JOIN operation between the "orders" and "salesmen" tables,
filtering data to fetch orders specifically associated with salespeople located in London. This
structured query employs table joins and conditional statements to accurately extract order details
tied to salespeople in London. The utilization of SQL's JOIN functionality demonstrates the
capability to combine data from different tables based on common columns, facilitating precise
data extraction based on specified criteria.
2. Orders by Salesman 'Paul Adam':
The SQL query adeptly employs a subquery within the WHERE clause, referencing the "salesman"
table to retrieve the salesman_id corresponding to the salesperson 'Paul Adam'. This subquery-
driven approach effectively filters data in the "orders" table, isolating and presenting detailed
information about all orders specifically associated with 'Paul Adam'. It showcases the versatility
of SQL's subquery functionality, allowing for focused data retrieval based on specific criteria
within a relational database.