[go: up one dir, main page]

0% found this document useful (0 votes)
45 views4 pages

DBMS Lab Report 07 - Ankit Pangeni

Uploaded by

sabin Bhandari
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)
45 views4 pages

DBMS Lab Report 07 - Ankit Pangeni

Uploaded by

sabin Bhandari
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/ 4

B.Sc.

CSIT
4 Semesterth

Database Management System: CSC260

Lab-07 (Continue From Lab 06 dbms3)

OBJECTIVE

TO STUDY AND IMPLEMENT NESTED/SUB QUERIES

REQUIRED THEORY
 A Subquery or Inner query or a Nested query is a query within another SQL query and embedded within
the WHERE clause.

 A subquery is used to return data that will be used in the main query as a condition to further restrict
the data to be retrieved.

 Subqueries can be used with the SELECT, INSERT, UPDATE, and DELETE statements along with the
operators like =, <, >, >=, <=, IN, BETWEEN, etc.:

QUESTIONS
Table: Same as Lab 06. Use database dbms3.

All the questions below need to be done using Subquery/ Nested Query

Q.1) Display a list of book published by 'Rainbow'. (in your query, you cannot write where
PublisherID='P02', you need to write WHERE name ='Deitel' using a subquery)

Q.2) Display a list of book published by 'Pearson' and written by 'S.Hanson'.

Q.3) Display a list of book published by 'Pearson' which cost more than 80.

Q.4) Display a list of book published by 'Pearson' which cost between 30 to 70 and written by 'J.Wenton'.

Using SQL MIN() Function

Q.5) Display the book which has the lowest price. (in the result table, give the column name as "LowestPrice")

Using SQL MAX() Function

Q.6) Display the book which has the highest price.(in the result table give the column name as "HighestPrice")

Using SQL AVG() Function

Q.7) Display a list of books (showing name and price) which cost more than the average price.

Q.8) Find the average price of books published by „Pearson‟. (in the result table,give the column name as
“AvgPrice”)

Q.9) Count how many books are published by „Rainbow‟. (in the result table, give the column name as
“NumOfBook”)

Q.10) Sum the Price of books published by „Pearson‟. (in the result table, give the column name as
“TotalPrice”)

Q.11) Display a list of book where its publisher‟s address is „Bukit Jalil‟.

Submitted by: Ankit Pangeni, Roll : 04


COMMANDS AND OUTPUTS

Question 1:

Question 2:

Submitted by: Ankit Pangeni, Roll : 04


Question 3:

Question 4:

Question 5:

Question 6:

Question 7:

Question 8:

Submitted by: Ankit Pangeni, Roll : 04


Question 9:

Question 10:

Question 11:

CONCLUSION

Hence, using MariaDB in lab, we studied and implemented nested/sub queries.

Submitted by: Ankit Pangeni, Roll : 04

You might also like