0% found this document useful (0 votes)
2 views1 page

MySQL Practice Questions and Exercises

The document contains a series of MySQL practice questions focused on creating and manipulating a 'Books' table. It includes tasks such as creating the table, inserting records, updating and deleting entries, adding and dropping columns, and performing various queries to analyze book data. The questions cover a range of SQL operations including sorting, filtering, and aggregating data.
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)
2 views1 page

MySQL Practice Questions and Exercises

The document contains a series of MySQL practice questions focused on creating and manipulating a 'Books' table. It includes tasks such as creating the table, inserting records, updating and deleting entries, adding and dropping columns, and performing various queries to analyze book data. The questions cover a range of SQL operations including sorting, filtering, and aggregating data.
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

MySQL Practice Questions

1. Create a table named 'Books' with columns: BookID (INT, Primary Key), Title (VARCHAR), Author

(VARCHAR), Price (FLOAT).

2. Insert 3 records into the 'Books' table with your own data.

3. Write a query to display all records from the 'Books' table.

4. Write a query to update the price of a book where BookID is 101.

5. Delete a record from the 'Books' table where BookID is 102.

6. Add a new column 'Publisher' (VARCHAR) to the 'Books' table.

7. Drop the 'Publisher' column from the 'Books' table.

8. Write a query to display books priced above 300.

9. Write a query to display books by a specific author (e.g., 'J.K. Rowling').

10. Display all books sorted by price in descending order.

11. Write a query to display titles starting with 'T'.

12. Display all books that have 'Science' in their title.

13. Write a query to display books with price between 200 and 500.

14. Find the total number of books in the table.

15. Calculate the average price of books.

16. Find the maximum and minimum book price.

17. Count the number of books written by each author.

18. Find the total price of books by each author.

19. Display authors having more than 1 book in the table.

20. Write a query to group books by author and show the average price per author.

You might also like