With MySQL, I need help creating queries for the following: 1. Display the first
ID: 3741397 • Letter: W
Question
With MySQL, I need help creating queries for the following:
1. Display the first and last name along with the phone number of all Agents.
2. Display the Book author, title and number of pages for all Books with more than 1000 pages.
3. Display the Author name for all Authors sorted by last name and first name (in that order).
4. Display the number of Authors who do NOT have Agents.
5. Display the total number of Books that contain ‘Hobbit’ in the title.
6. Display the Author’s first and last name and their Agent’s first and last name for all Author’s whose last name starts with the same first letter of your last name (if no match try the first letter of your first name but could result in no match).
7. Display the Book title and Author’ first and last name of the Books whose genre is either Biography or History.
8. Display the Author’s first and last name, Book’s title and genre, Editor’s first and last name for all Books that are in the science fiction genre.
9. Display each Editor’s first and last name along with their mentor’s first and last name with column headers MentorFirstName and MentorLastName respectively.
10. Display the Editors’ first and last name, as well as the Book’s title sorted by Book’s title first and the Editor’s last name second for all Books that were published on September 26, 2006.
11. Display the Editor’s first and last name along with their ID for the Editor that has edited the most Books for Coastal Publishing.
12. Display each Author’s ID, first and last names and the total number of pages for all of the Books they have written.
13. Display the Author’s ID, first and last name of the Author who has the most Books in the Coastal Publishing database.
14. Display each Book genre as well as the number of Books written in that genre with the column header “Number Of Books”
15. Display the Author’s first and last name, as well as their ID, and the Book title and number of pages for all of the books they have written that have more than the average number of pages for all of the books that have been written, listed by author’s first and last name along with the book title, and the book’s number of pages.
___________________________________________
Here are the downloads for the setup and inserts files:
MySQL Setup File: https://www.dropbox.com/s/2yyx1t2ntfa02xg/CoastalPublishingSetup.sql?dl=0
MySQL Inserts File: https://www.dropbox.com/s/zldaunxis6j5rf5/CoastalPublishingInserts.sql?dl=0
Explanation / Answer
As per Chegg guidelines, if a question of the user contains more than one question then the expert need to answer the first question. But I answered the first four questions. Hope you read the guidelines and understand. :)
1. SELECT fname, lname FROM Agents
2. SELECT author, title, pages FROM Books WHERE pages > 1000
3. SELECT lname, fname FROM Authors ORDER BY lname, fname
4. SELECT A.name
FROM Author A
WHERE
NOT EXISTS (SELECT * FROM Agent ag WHERE Ag.authorID = A.id)
5. SELECT COUNT(*) FROM Books where name = "Hobbit"
**Comment for any further queries.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.