Question

In: Computer Science

IN MY SQL: - Display each Author’s ID, first and last names and the total number...

IN MY SQL:

- Display each Author’s ID, first and last names and the total number of pages for all of the Books they have written.

- Display each Book genre as well as the number of Books written in that genre with the column header “Number Of Books”

- 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.

- Display the Author’s or Authors’ ID, first and last name of the Author who has the most Books in the Coastal Publishing database.

LINK TO WHAT THE SETUP AND INSERTS LOOK LIKE:

https://docs.google.com/document/d/1Qb30rS-g03pUBBFGBRwq-f9L8CsHY0Dz_HKpt_lt9uM/edit?usp=sharing

Solutions

Expert Solution

1.

Select AuthorID,AuthorFirstName,AuthorLastName, SUM(BookNumberOfPages) from CoastalPublishing.Author inner join CoastalPublishing.Book on CoastalPublishing.Author.AuthorID = CoastalPublishing.Book.Author_authorID group by AuthorID,AuthorFirstName,AuthorLastName;

2.

Select BookGenre , Count(BookTitle) as 'Number Of Books' from CoastalPublishing.Book group by BookGenre;

3.

Select AuthorID,AuthorFirstName,AuthorLastName, SUM(BookNumberOfPages) from CoastalPublishing.Author inner join CoastalPublishing.Book on CoastalPublishing.Author.AuthorID = CoastalPublishing.Book.Author_authorID group by AuthorID,AuthorFirstName,AuthorLastName having SUM(BookNumberOfPages) > AVG(BookNumberOfPages) order by AuthorFirstName,AuthorLastName, BookTitle, SUM(BookNumberOfPages);

4.

Select AuthorID,AuthorFirstName,AuthorLastName, SUM(BookNumberOfPages) from CoastalPublishing.Author inner join CoastalPublishing.Book on CoastalPublishing.Author.AuthorID = CoastalPublishing.Book.Author_authorID group by AuthorID,AuthorFirstName,AuthorLastName having Count(BookTitle) = Max(BookTitle);

Do ask if any doubt. Please upvote.


Related Solutions

How to display in SQL Server, for example, all the author First Names are FIVE LETTERS...
How to display in SQL Server, for example, all the author First Names are FIVE LETTERS LONG if I have the Author Table. I used the WHERE LENGTH ua_fname=5   This is not returning names with 5 letters. Can someone please suggest to me the correct one?
This class has two constructors. The default constructor (the one that takes no arguments) should initialize the first and last names to "None", the seller ID to "ZZZ999", and the sales total to 0.
For this assignment, implement and use the methods for a class called Seller that represents information about a salesperson.The Seller classUse the following class definition:class Seller { public:   Seller();   Seller( const char [], const char[], const char [], double );        void print();   void setFirstName( const char [] );   void setLastName( const char [] );   void setID( const char [] );   void setSalesTotal( double );   double getSalesTotal(); private:   char firstName[20];   char lastName[30];   char ID[7];   double salesTotal; };Data MembersThe data members for the class are:firstName holds the Seller's first namelastName holds the Seller's last nameID holds the Seller's id numbersalesTotal holds the Seller's sales totalConstructorsThis class has two constructors. The default constructor (the one that takes...
1. Write the SQL code required to list the employee number, first and last name, middle...
1. Write the SQL code required to list the employee number, first and last name, middle initial, and the hire date. Sort your selection by the hire date, to display the newly hired employees first. 2. Modify the previous query and list the employee first, last name and middle initial as one column with the title EMP_NAME. Make sure the names are listed in the following format: First name, space, initial, space, last name (e.g. John T Doe). Hint: use...
Create a program that allows a user to input customer records (ID number, first name, last...
Create a program that allows a user to input customer records (ID number, first name, last name, and balance owed) and save each record to a file. When you run the main program, be sure to enter multiple records. Once you create the file, open it and display the results to the user Save the file as  CustomerList.java
Problem 44 Write a query to display the employee number, last name, first name, and sum...
Problem 44 Write a query to display the employee number, last name, first name, and sum of invoice totals for all employees who completed an invoice. Sort the output by employee last name and then by first name (Partial results shown in Figure P7.44).
We plan to develop customer’s database that stores customer’s number (ID), first name, last name and...
We plan to develop customer’s database that stores customer’s number (ID), first name, last name and balance. The program will support three operations: (a) reading and loading customer’s info from the text file, (b) entering new customer’s info, (c) looking up existing customer’s info using customer’s number(ID), (d) deleting the customer’s info and (e) the updated database will be stored in the text file after the program terminate. Customer’s database is an example of a menu-driven program. When the program...
We plan to develop customer’s database that stores customer’s number (ID), first name, last name and...
We plan to develop customer’s database that stores customer’s number (ID), first name, last name and balance. The program will support three operations: (a) reading and loading customer’s info from the text file, (b) entering new customer’s info, (c) looking up existing customer’s info using customer’s number(ID), (d) deleting the customer’s info and (e) the updated database will be stored in the text file after the program terminate. Customer’s database is an example of a menu-driven program. When the program...
When all of the entries are valid, display an account number that shows first 3 digits of the telephone number and first two letters of the last name.
When all of the entries are valid, display an account number that shows first 3 digits of the telephone number and first two letters of the last name. using name John Smith phone number 1234567893 Using net beans take the first two letters from smith and first 3 numbers from the phone number and combine them to one line like this sm123.
Web Programming Task + Database sql Write a command to display the ISBN number and the...
Web Programming Task + Database sql Write a command to display the ISBN number and the price in the table books. Question #2: What command did you enter? Answer: Write a command to increase the price of each book in the table books by 50 cents. Question #3: What command did you enter? Answer: Write a command to display the price and title in the table books of ISBN 0-672-31697-8 Question #4: What command did you enter? Answer: Write a...
Write an SQL query that will output the employee id, first name and hire date from...
Write an SQL query that will output the employee id, first name and hire date from the employee table. Pick only those employees whose employee ID is specified in the employee table (no nulls). If the employee id is 777, name is ABC and hire date is 01-JAN-2016, the output should be like - ' ABC (Employee ID - 777) was hired on 1, January of 2016'. Note - The date should not have preceding zeros.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT