Page 50 - IP
P. 50
OR
All the columns having capability to become Primary Key are known as
Candidate Keys.
(ii) Which column can be considered as foreign key column in Transaction table? 1
OR
Identify Primary Key column of Transaction table.
Ans: Acc_No
OR
Trans_Id
(1 mark for correct answer)
(c) With reference to the above given tables, attempt the questions given below: 6
i. Write a query to display customer’s name who has withdrawn the money.
OR
Write a query to display customer’s name along with their transaction
details.
ii. Write a query to display customer’s name who have not done any
transaction yet.
OR
How many rows and column will be there in the Cartesian product of the
above given tables. Also mention the degree and cardinality of the Cartesian
product of the above given tables.
iii. Select Acc_No, sum(Amount) from Customer c, Transaction t where
c.Acc_No=t.Acc_No group by c.Acc_No having Transaction_Type="Credit";
OR
Discuss the significance of having clause with group by statement with
suitable example.
Ans: i. Select cust_name from customer c,transaction t where c.Acc_No=t.Acc_No
and Transaction_Type= "Debit";
OR
Select cust_name, t.* from customer c, transaction t where
c.Acc_No=t.Acc_No;
(2 mark for correct query)
ii. Select cust_name from customer c,transaction t where
c.Acc_No!=t.Acc_No;
(2 mark for correct query)
OR
Cartesian Product:
Number of Rows: 20
Number of Columns: 9
Degree: 9
Cardinality: 20
( ½ mark for each correct answer)
13