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.