SQL - Set Operations and Subqueries: Create Two Tables With The Following Details
SQL - Set Operations and Subqueries: Create Two Tables With The Following Details
SQL - Set Operations and Subqueries: Create Two Tables With The Following Details
PART A
Create two tables with the following details
Customer_Fixed_Deposit(cust_ID,Cust_name,Fixed_Deposit_Amount)
1. Find all customers who have either having Fixed Deposit (FD) or
loan or both
2. List all customers who have both Fixed Deposit and Loan using
set operation.
4. Get all Customers who have not taken a Loan using set operation.
5. Get all Customers who have not taken a Loan using subquery.
select Cust_ID ,Cust_name from Customer_Fixed_Deposit where Cust_ID not
in(select Cust_ID from Customer_Loan);
9. Find the names of the customers who have taken the maximum loan
amount.
10. Find the number of customers who have both Fixed Deposit and
Loan.
select count (Cust_name)from (select Cust_ID ,Cust_name from
Customer_Fixed_Deposit union select Cust_ID ,Cust_name from
Customer_Loan) ;
PART B
SELECT 1,'Software',1700
SELECT 2,'HR',1200
SELECT 3,'Testing',1700
FROM DUAL
SELECT 2,'Saro','S','Saro@gmail.com',944415744,TO_DATE('17/12/2015',
'DD/MM/YYYY'),9,60000,20,2
FROM DUAL