0% found this document useful (0 votes)
40 views2 pages

Chapter4 Worksheet Equi-Join 1

The document provides a worksheet for Grade XII students at the Emirates National School in Sharjah, focusing on database queries using MySQL. It includes two sets of tables: SalesPerson and Orders, along with SQL commands to extract specific information, and a second set with CUSTOMER and TRANSACTION tables for further queries. Students are tasked with identifying keys, foreign keys, and writing SQL commands to analyze customer transactions.
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)
40 views2 pages

Chapter4 Worksheet Equi-Join 1

The document provides a worksheet for Grade XII students at the Emirates National School in Sharjah, focusing on database queries using MySQL. It includes two sets of tables: SalesPerson and Orders, along with SQL commands to extract specific information, and a second set with CUSTOMER and TRANSACTION tables for further queries. Students are tasked with identifying keys, foreign keys, and writing SQL commands to analyze customer transactions.
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

THE EMIRATES NATIONAL SCHOOL – SHARJAH

INFORMATICS PRACTICES
Grade XII (2025-’26)
CHAPTER 4 – Database Query Using MySQL
EQUI-JOIN [WORKSHEET – 1]
1. Consider the tables given below:

Table: SalesPerson Table: Orders

SalesP_ID Name Age Salary OrderID SalesP_ID Amount

1 Ajay 61 140000 10 2 54000


2 Sunil 34 44000 20 7 18000

5 Chris 34 40000 30 1 46000

7 Amaaya 41 52000 40 5 24000

With reference to the above tables, write commands in SQL for (i) and (ii) and output for (iii)
a) To display the salesperson ID, name, order ID and order amount of all salespersons

b) To display the name, order ID and Salary of those sales persons whose name start with ‘A’
and sales amount is between 15000 and 20000.

c) SELECT SALESPERSON.SALESP_ID, NAME, AGE, AMOUNT


FROM SALESPERSON, ORDERS
WHERE SALESPERSON.SALESP_ID = ORDERS.SALESP_ID
AND AGE BETWEEN 30 AND 45;

2. In a BANK’s database, there are two tables ‘CUSTOMER’ and ‘TRANSACTION’ as shown
below:
Table: CUSTOMER
Acc_No Cust_Name Cust_City Cust_Phone Open_Bal
2101001 Sunita Ambala 9710557614 10000
2201002 Sandhya Patna 8223545233 15000
2301003 Vivek New Delhi 9972136576 13000
2401004 Meena New Delhi 9321305453 10000

Table: TRANSACTION
TransID Acc_No Transaction_Type Amount
Tr001 2301003 Credit 15000
Tr002 2201002 Credit 20000
Tr003 2101001 Debit 3500
Tr004 2301003 Credit 26000
Tr005 2301003 Credit 24000
Based on the above tables (Qn 2), answer the following questions:
a) Identify the Candidate keys of Customer table.
b) Which column can be considered as the foreign key column in Transaction table?
c) Identify the primary key of both the tables.
d) What will be the degree and cardinality of the Cartesian product of the above tables
Customer and Transaction?
Write SQL commands for the following:

e) To display the list of customers who have withdrawn money.


f) To display the customer’s name along with their transaction details.
g) To display the total amount for each transaction type.
h) To display the transaction details of those customers from New Delhi.

You might also like