0% found this document useful (0 votes)
10 views2 pages

MySQL Commands for LIBRARY Table Operations

The document provides a set of MySQL commands for various operations on a LIBRARY table, including retrieving book titles of a specific type, displaying a report of books sorted by price, counting the number of books of a certain type, and inserting a new book entry. Specific SQL queries are given for each operation. Additionally, it includes commands to calculate the average price of a book type and count distinct book types in the library.

Uploaded by

alistairv07
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

MySQL Commands for LIBRARY Table Operations

The document provides a set of MySQL commands for various operations on a LIBRARY table, including retrieving book titles of a specific type, displaying a report of books sorted by price, counting the number of books of a certain type, and inserting a new book entry. Specific SQL queries are given for each operation. Additionally, it includes commands to calculate the average price of a book type and count distinct book types in the library.

Uploaded by

alistairv07
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

SET A

Consider the table LIBRARY given below. Write commands in MySQL for (i) to
(iv) and output for (v) to (vii).
TABLE LIBRARY

(i) To list the BookTitle of FND type.


(ii) To display a report listing BookTitle, Type and Price in descending order of
price.
(iii) To count the number of BookTitle, Who have FND type.
(iv) To insert a new row in the table LIBRARY.
7, ‘Windows 8 Basics’, ‘FND’,’McGraw’, 7,150.

(v) SELECT AVG(Price) FROM LIBRARY WHERE Type = ‘FND’;

(vi) SELECT COUNT(DISTINCT Type) FROM LIBRARY;

Answer:
(i) SELECT BookTitle FROM LIBRARY WHERE Type = ‘FND’;

(ii) SELECT BookTitle, Type, Price FROM LIBRARY


ORDER BY Price DESC;

(iii) SELECT COUNT(*)


FROM LIBRARY WHERE Type = 'FND';

(iv) INSERT INTO LIBRARY VALUES (7, ‘Windows 8 Basics', ‘ FND’ ,


‘McGraw’,7,150);

You might also like