Question
Needing some help on making these SQL tables and then launching the queries with them the thing we use is pure SQL coding in like
Needing some help on making these SQL tables and then launching the queries with them the thing we use is pure SQL coding in like a playground server so if it can be something similar to that it be great! 1. Create two tables: books and authors.
2. In the books table, include the following columns: book_id (primary key, auto-increment), title, publish_date, price, author_id (foreign key referring to the authors table)
3. In the authors table, include the following columns: author_id (primary key, auto-increment), first_name, last_name, nationality.
4. Insert at least 5 books into the books table, each with a different title, publish_date, and author_id that references a valid author_id in the authors table.
5. Insert at least 5 authors into the authors table, each with a different first_name, last_name, and nationality.
6. Write a SQL query to retrieve the book_id, title, publish_date, and first_name and last_name of the author for all books in the books table.
7. Write a SQL query to retrieve the author_id, first_name, last_name, and the title of all books written by a specific author. The query should take the author's first_name and last_name as input parameters.
8. Write a SQL query to update the nationality of an author in the authors table. The query should take the author's author_id and the new nationality as input parameters.
9. Write a SQL query to delete a book from the books table based on the book_id.
10 .Write a SQL query to retrieve the average price for all books in the books table.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started