0% found this document useful (0 votes)
6 views9 pages

121 (1) - Merged

The document outlines a series of programming tasks related to database management, including creating and opening a database, inserting values, and describing a table. It also provides specific SQL queries for various operations such as finding book titles and authors, calculating average prices, and updating records. The tasks cover a range of SQL functionalities including selection, aggregation, updating, and deletion.

Uploaded by

dharasuvhadeep
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)
6 views9 pages

121 (1) - Merged

The document outlines a series of programming tasks related to database management, including creating and opening a database, inserting values, and describing a table. It also provides specific SQL queries for various operations such as finding book titles and authors, calculating average prices, and updating records. The tasks cover a range of SQL functionalities including selection, aggregation, updating, and deletion.

Uploaded by

dharasuvhadeep
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/ 9

Q1.

Write a program to Create a Database , Open


Database and create a table.

Q2. Write a program to Insert values on table and


describe the table.
Q3. Write a SQL Query based on the table given
above:-
(i) Write a SQL query to find the titles and authors of all fiction
books.

(ii) Write a SQL query to find the average price of all books.

(iii) Write a SQL query to list the titles of books published before
the year 1950.
(iv) Write a SQL query to find the title and price of the most
expensive book.

(v) Write a SQL query to count the number of books in the


'Fiction' genre.
(vi) Write a SQL query to find the books whose titles start with
'The'.

(vii) Write a SQL query to list the titles and prices of books, sorted
by price in descending order.

(viii) Write a SQL query to find the titles and authors of books that
have a price between 10 and 15.
(ix) Write a SQL query to update the price of 'Moby Dick' to 13.99.

(x) Write a SQL query to delete the book record where the
BookID is 8.

(xi) Write a SQL query to add a new column 'Publisher' to the


Books table.
(xii) Write a SQL query to set the 'Publisher' of all books to
'Penguin Books'.

(xiii) Write a SQL query to count the total number of books in the
Books table.

(xiv) Write a SQL query to find the title and price of the cheapest
book.
(xv) Write a SQL query to group the books by genre and find the
average price for each genre.

You might also like