a) SELECT Customer_name,Branch_Name
FROM Loan,Borrower
WHERE Loan.Loan_Number=Borrower.Loan_Number
and Branch_Name='Delhi';
(ii) SELECT Loan.Loan_Number,Customer_Name,Amount
FROM Loan,Borrower
WHERE Loan.Loan_Number=Borrower.Loan_Number
AND Amount>40000;
(iii) SELECT Branch_name, AVG(Amount) AS Average_Amount
FROM LOAN
GROUP BY Branch_name
HAVING AVG(Amount) > 50000;
(iv) A. SELECT Customer_Name,Amount
FROM Loan,Borrower
WHERE Loan.Loan_Number=Borrower.Loan_Number
ORDER BY Amount DESC;
OR
B. The degree of the resultant table will be 4.
(a) UPDATE FLIGHT SET Fare=9700 WHERE FNO=’F103’;
(b) SELECT START, COUNT(*)
FROM FLIGHT
GROUP BY START
HAVING START IN ('DELHI', 'MUMBAI');;
(c) SELECT NAME, FARE, GENDER FROM FLIGHT F, PASSENGER P
WHERE [Link] = [Link];
(d) SELECT * FROM FLIGHT ORDER BY FARE Desc;
start Count(*) Count(*)
Mumbai 2 5
Delhi 3
Write SQL queries for the following:
(i) Display product name and brand name from the
tables PRODUCT and BRAND.
(ii) Display the structure of the table PRODUCT.
(iii) Display the average rating of Medimix and Dove
brands
(iv) Display the name, price, and rating of products in
descending order of rating.
(i)
SELECT PName, BName FROM PRODUCT P, BRAND B WHERE [Link]=[Link];
(ii)
DESC PRODUCT;
(iii)
SELECT BName, AVG(Rating)
FROM PRODUCT P, BRAND B WHERE [Link]=[Link]
GROUP BY BName HAVING BName IN ('Medimix' ,'Dove');
(iv)
SELECT PName, UPrice, Rating
FROM PRODUCT ORDER BY Rating DESC;