Question: Needing some help on making these SQL tables and then launching the queries with them 1. Create two tables: books and authors. 2. In the

Needing some help on making these SQL tables and then launching the queries with them 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!