PLEASE WRITE THIS IN SQL QUERY. (IS 3063) SQL Exam #2 - Single Table Queries For
ID: 3755202 • Letter: P
Question
PLEASE WRITE THIS IN SQL QUERY. (IS 3063)
SQL Exam #2 - Single Table Queries
For each information request below, formulate a single SQL query to produce the required information. Read the problems carefully and in each case, you should display only the columns requested. Be sure that your queries do not produce duplicate records unless otherwise directed.
The interface below may not remember queries you have written if you have to leave the page for any reason before you submit, so be sure to keep a copy of your queries in case you need to enter them again.
QUESTIONS:
6. What ProductIDs were sold in December 2014? Show each productID only once. Hint: Your query should only have one column: ProductID.
7. What is the price rounded to the nearest dollar of all boots in the database? Show product name, color, and rounded price (give this column an alias of RoundedPrice). Hint: Remember that all categories are all lowercase.
8. Show the name, city, state, phone number, and first two digits of the postal code for manufacturers in Oregon (OR) and Washington (WA). Give the last column an alias of ZipPrefix.
9. Show the name, color, and ManufacturerID for all sneakers that DO have a color listed.
10. Show the last name, state, and phone number for customers with customerIDs between 17700 and 17800. In the phone number column, change all of the dashes to periods. Give this column an alias of PhoneFormatted. Hint: Your query results should have 3 columns: LastName, State, and PhoneFormatted.
Explanation / Answer
Assuming table name Product.
6. SelectProductID from Product where Date='December 2014';
7. Select name,color, CEILNG(price) AS RoundedPrice from Prodect;
8. Select name , city, phone number, LEFT(postal code, 2) AS ZipPrefix from Prodct
where manufactuers =Oregon(OR) AND manufactuers= Washington(WA);
9. Select name,color , ManufactureID from Product where color IS NOT NULL;
10. Select last name, state , REPLACE(phone number, '-', '.') AS PhoneFormatted from Customer
where CustomerID BETWEEN 17700 AND 17800;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.