This question is based on the following data and tables. Create a database named books( make sure you don’t forget to select the database) and run the MySQL queries below to be able to complete the following MySQL Queries. For each MySQL query, screenshot the output and include the MySQL query in your submission PDF. -- Authors Table CREATE TABLE authors ( author_id INT PRIMARY KEY AUTO_INCREMENT, author_name VARCHAR(255) NOT NULL, birth_year INT ); -- Sample Data INSERT INTO authors (author_name, birth_year) VALUES ('J.K. Rowling', 1965), ('George Orwell', 1903), ('Jane Austen', 1775); -- Books Table CREATE TABLE books ( book_id INT PRIMARY KEY AUTO_INCREMENT, title VARCHAR(255) NOT NULL, publication_year INT, author_id INT, FOREIGN KEY (author_id) REFERENCES authors(author_id) ); -- Sample Data INSERT INTO books (title, publication_year, author_id) VALUES ('Harry Potter and the Sorcerer''s Stone', 1997, 1), ('1984', 1949, 2), ('Pride and Prejudice', 1813, 3); a-  Write a MySQL query that selects the author with the earliest birth year. b-  WriteaMySQLquerythatwillfindthetitlesofbookspublishedaftertheyear1900from the books table. c-  Write a MySQL query that utilizes a join to retrieve the names of authors and the titles of their books (if any) from the authors and books tables. d-  WriteaMySQLquerythatwillcalculatetheaveragebirthyearforallauthors. e-  Write a MySQL query that will count the number of books written by each author. Include the author's name and the count of books. Show authors even if they have written zero books

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter8: Working With Advanced Functions
Section: Chapter Questions
Problem 2.7CP
icon
Related questions
Question

This question is based on the following data and tables. Create a database named books( make sure you don’t forget to select the database) and run the MySQL queries below to be able to complete the following MySQL Queries. For each MySQL query, screenshot the output and include the MySQL query in your submission PDF.

-- Authors Table CREATE TABLE authors (

author_id INT PRIMARY KEY AUTO_INCREMENT, author_name VARCHAR(255) NOT NULL, birth_year INT

);

-- Sample Data
INSERT INTO authors (author_name, birth_year) VALUES ('J.K. Rowling', 1965),
('George Orwell', 1903),
('Jane Austen', 1775);

-- Books Table CREATE TABLE books (

book_id INT PRIMARY KEY AUTO_INCREMENT, title VARCHAR(255) NOT NULL, publication_year INT,
author_id INT,

FOREIGN KEY (author_id) REFERENCES authors(author_id) );

-- Sample Data

INSERT INTO books (title, publication_year, author_id) VALUES ('Harry Potter and the Sorcerer''s Stone', 1997, 1),
('1984', 1949, 2),
('Pride and Prejudice', 1813, 3);

  1. a-  Write a MySQL query that selects the author with the earliest birth year.

  2. b-  WriteaMySQLquerythatwillfindthetitlesofbookspublishedaftertheyear1900from

    the books table.

  3. c-  Write a MySQL query that utilizes a join to retrieve the names of authors and the titles

    of their books (if any) from the authors and books tables.

  4. d-  WriteaMySQLquerythatwillcalculatetheaveragebirthyearforallauthors.

  5. e-  Write a MySQL query that will count the number of books written by each author.

    Include the author's name and the count of books. Show authors even if they have written zero books. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Can I get a screen shot for each querirs 

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
SQL Query
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning