Write just one SQL statement for each question Question 1 Li
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
Solution
Question 1: SELECT Publisher name, city FROM Publisers
Question 2: SELECT book titles, price, advance paid FROM Publishers
WHERE advance paid>=10000 OR price>=$30
Question 5: SELECT author name, number of books sold FROM Publishers
WHERE number of books sold BETWEEN 5000 AND 10000
