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

q4 Practicals PDF

The document provides the tables for a LIBRARY database and SQL statements to query the tables. It includes statements to select book details by publisher, book type, ordered price, update book price by publisher, select issued books by ID and name, insert a new issued book record, and output counts, maximums, and selections by criteria.

Uploaded by

sumit1197
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)
49 views3 pages

q4 Practicals PDF

The document provides the tables for a LIBRARY database and SQL statements to query the tables. It includes statements to select book details by publisher, book type, ordered price, update book price by publisher, select issued books by ID and name, insert a new issued book record, and output counts, maximums, and selections by criteria.

Uploaded by

sumit1197
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/ 3

Q4: Given the following tables for a database LIBRARY:

Write SQL statements for:


a) To show book name, author name and price of the book of First Publ. Publishers
SQL: SELECT BOOK_NAME, AUTHOR_NAME, PRICE FROM BOOK_DETAILS
WHERE PUBLISHERS = 'First Publ.';
OUTPUT:

b) To list the names of the book of text type:


SQL: SELECT BOOK_NAME FROM BOOK_DETAILS WHERE TYPE = 'Text';
OUTPUT:

c) To display the names and price from books in ascending order of their price.
SQL: SELECT BOOK_NAME,PRICE FROM BOOK_DETAILS ORDER BY PRICE
ASC;
OUTPUT:
d) To increase the price of all books of EPB publishers by 50.
SQL: UPDATE BOOK_DETAILS SET PRICE = PRICE + 50 WHERE PUBLISHERS =
'EPB';
OUTPUT:

e) To display the Book_ID, Book_Namd and Quantity_Issued for all books which have
been issued.
SQL: SELECT BOOK_DETAILS.Book_ID, BOOK_DETAILS.Book_Name,
BOOK_ISSUED.Quantity_Issued FROM BOOK_DETAILS, BOOK_ISSUED
WHERE BOOK_DETAILS.Book_ID = BOOK_ISSUED.Book_ID;
OUTPUT:

f) To insert a new row in the table issued during the following data: “F0003”,
SQL: INSERT INTO BOOK_ISSUED (Book_ID,Quantity_Issued) VALUES ('F0003',1);
OUTPUT:
Give the output for the following SQL queries:
a) select count(*) from book.

b) Select max(Price) from books_details where quantity >= 15.

c) select book_name, author_name from book_details where Publishers = ‘EFB’.

d) Select count (Distinct Publishers) from books where price >= 400;

You might also like