0% found this document useful (0 votes)
5 views3 pages

16.2.SQL Join Questions

The document contains a series of SQL queries related to loan and flight data management, including selections of customer names, loan amounts, and average amounts by branch. It also includes update and selection queries for flight fare and passenger details, as well as queries for product and brand information. The queries demonstrate various SQL operations such as joins, groupings, and orderings to retrieve and manipulate data from multiple tables.

Uploaded by

zuzu
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)
5 views3 pages

16.2.SQL Join Questions

The document contains a series of SQL queries related to loan and flight data management, including selections of customer names, loan amounts, and average amounts by branch. It also includes update and selection queries for flight fare and passenger details, as well as queries for product and brand information. The queries demonstrate various SQL operations such as joins, groupings, and orderings to retrieve and manipulate data from multiple tables.

Uploaded by

zuzu
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

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;

You might also like