Assignment title: Management


In this assignment, you are going to use the tables that you have created for the seminar #4 using "Books_DB.sql." Answer the following questions by developing SQL statements and generating the corresponding outputs. Write just one SQL statement for each question. Question 1: List the Publisher name and city that they are based in so that the data in the result set appears in the following format: "Publisher American Publishing is in Boston" Put the results in publisher name order. Question 2: Write a SELECT statement that shows book titles, the price, and the advance paid but only show books that have been given an advance of 10000 or more or whose price is greater than $30. If the advance or price is NULL show that as well. Question 3: Write a select statement that shows the average advance, the total number books sold, and the number of books being published by Sunshine Publishers and All Techo Books. Question 4: Write a SELECT statement that shows all authors who live in Oakland, California and are based in the same state as one of the publishers. The SELECT list should display the following: The publisher's name and city, the author's name, city, and state. Question 5: Write a SELECT statement that lists the author name and the number of books they have sold. Show authors who have sold between 5000 and 10000 books. Question 6: Write a SELECT statement that shows all books and the authors who have written them, if the book has an author assigned to it and the book title begins with the letter 'T'. (Hint: you need two joins.) Question 7: Write a SELECT statement (with a subquery) that lists a publisher and all their books that have been given an advance that is less than average. Question 8: INSERT a new row into the book table (make up any values that work) but use a date function to pass the published date value in the following format.... April 1, 2014 ... to the table. (Hint: you need to use the function TO_DATE.)(After running your statement, show that the new row has been added to the table by running a proper SELECT statement.) Question 9: Write a SQL statement to add "BooksRUs" as a publisher to the database. The publisher's ID is 7, the address is "456 Publisher Lane, St. Louis, MO ". (After running your statement, show that the new record has been added to the table by running a proper SELECT statement.) Question 10: Change the type to "geeky" for any book that has the word "Computer" or "Networking" in the title. (After running your statement, show that the types of those books have been changed by running a proper select statement.) Question 11: List all books and their price where the price of the book is less than the book with the highest price. Pick the correct ANY or ALL modifier to solve this problem. Question 12: Write a UNION between the firstname and lastname of the editor and author tables where the first three digits of the Social Security number are 722. Use a string expression to indicate whether or not someone is an author or editor Part 2 (Each 5 Points) The following tables form part of a database held in a relational DBMS:- Hotel (hotelNo, hotelName, city) Room (roomNo, hotelNo, type, price) Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) Guest (guestNo, guestName, guestAddress) where Hotel contains hotel details and hotelNo is the primary key; Room contains room details for each hotel and (roomNo, hotelNo) forms the primary key; Booking contains details of the bookings and (hotelNo, guestNo, dateFrom) forms the primary key; and Guest contains guest details and guestNo is the primary key.Describe the relations that would be produced by the following relational algebra operations: a) hotelNo (price  50 (Room) ) b) Hotel.hotelNo  Room.hotelNo(Hotel  Room)