DBMS Lab Report 07 - Ankit Pangeni
DBMS Lab Report 07 - Ankit Pangeni
CSIT
4 Semesterth
OBJECTIVE
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.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'.
Q.5) Display the book which has the lowest price. (in the result table, give the column name as "LowestPrice")
Q.6) Display the book which has the highest price.(in the result table give the column name as "HighestPrice")
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‟.
Question 1:
Question 2:
Question 4:
Question 5:
Question 6:
Question 7:
Question 8:
Question 10:
Question 11:
CONCLUSION