Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can you help me write the SELECT statement for each of the following plese. SELE

ID: 3540274 • Letter: C

Question

Can you help me write the SELECT statement for each of the following plese.


SELECT

FROM

WHERE ;




1. Using the BOOK_ORDER table, create a query that will return the order number, order date, shipping address, city, state, and zip code for all orders going to Atlanta or Austin. Format the order date to display as Month DD, YYYY and give the column an alias of "Date Ordered". Be sure the month begins with a capital letter.



2. Using the BOOK_ORDER table, create a query using the correct function to return the order number, the date ordered, the date shipped, and a column representing the number of months between the two dates for all columns where a date shipped exists. Format the number returned from the function to display only two decimals, and give the column an alias of "Months Between".

NOTE: Be sure that all of the numbers in the fourth column are positive numbers.


3. Using the correct tables in your schema, create a query using traditional join operation that will list the title of each book and author name(s). Give the title column an alias of "Book Title". Sort the results by title and then by author last name.


4.Using the BOOKS table, create a query that will return the book title, cost, and retail price for all books with a title starting with the letter %u2018H%u2019. Use the correct conversion function to format the cost and retail columns to show dollars and cents with a dollar sign (e.g., a price of $25 would display $25.00 in the result set).


5. Using the BOOK_ORDER, ORDER_ITEMS, and BOOKS tables, create a query using an OUTER JOIN operation that will list the book title, order date, and order number for all books in the BOOKS table. Order your output in descending order by ORDER_ITEMS.BOOKID. There are three books that have never been ordered which should show up at the top of your listing.



6.Using the correct tables, create a query using the traditional join operation that will list the customer first and last name, book title, and order date (formatted as MM/DD/YYYY with an alias of %u201COrder Date%u201D) for all the customers who have purchased books published by 'PRINTING IS US'.



7.Using the BOOKS and ORDER_ITEMS table, write a query using the correct Relational Set Operator that will show all of the Book IDs in the BOOKS table that have not been ordered.



8.Using the BOOK_CUSTOMER, BOOK_ORDER, ORDER_ITEMS, and BOOKS tables, create a query using traditional join conditions based on comparisons between primary and foreign keys that will list the customer number, first and last name, and book title. Limit your listing to only those books in the %u2018FITNESS%u2019 category.


9.Using the BOOKS, ORDER_ITEMS, and BOOK_ORDER tables, create a query that will list the title, retail, quantity, and order date for all books ordered after April 30, 2009.


10.Using the correct tables, create a query using traditional join operation that will list the order id, order date, quantity ordered, and retail price for every book that has been ordered. Format the date as MM/DD/YYYY with an alias of %u201COrder Date%u201D and format the retail price column using the correct function to show dollars and cents with a dollar sign ( $ ) and a column alias of %u201CRetail%u201D.


Explanation / Answer

1. Using the BOOK_ORDER table, create a query that will return the order number, order date, shipping address, city, state, and zip code for all orders going to Atlanta or Austin. Format the order date to display as Month DD, YYYY and give the column an alias of "Date Ordered". Be sure the month begins with a capital letter.




SELECT ORDER_NUMBER, convert(varchar(20), ORDER_DATE, 107) DATEORDERED, ADDRESS, CITY, STATE, ZIPCODE

FROM BOOK_ORDER

WHERE CITY LIKE "%Atlanta%" OR "%Austin%"


2. Using the BOOK_ORDER table, create a query using the correct function to return the order number, the date ordered, the date shipped, and a column representing the number of months between the two dates for all columns where a date shipped exists. Format the number returned from the function to display only two decimals, and give the column an alias of "Months Between".

NOTE: Be sure that all of the numbers in the fourth column are positive numbers.



CREATE FUNCTION dbo.Order (@ORDER_NUMBER int)

RETURNS TABLE

AS

-- Returns the order number, the date ordered, the date shipped, Months Between

RETURN

(

SELECT ORDER_NUMBER, ORDER_DATE, SHIPPED_DATE,DateDiff (month, ORDER_DATE, SHIPPED_DATE) Months_Between

FROM BOOK_ORDER

WHERE CITY LIKE "%Atlanta%" OR "%Austin%"

)

END;

GO



3. Using the correct tables in your schema, create a query using traditional join operation that will list the title of each book and author name(s). Give the title column an alias of "Book Title". Sort the results by title and then by author last name.


Unless Provide other tables cant answer



4.Using the BOOKS table, create a query that will return the book title, cost, and retail price for all books with a title starting with the letter %u2018H%u2019. Use the correct conversion function to format the cost and retail columns to show dollars and cents with a dollar sign (e.g., a price of $25 would display $25.00 in the result set).


SELECT TITLE, COST, PRICE

FROM BOOKS

WHERE TITLE LIKE "%H%"

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote