Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. The Marketing Department has requested a new report of shipped orders for which the order was placed on either a Saturday or a Sunday.

1. The Marketing Department has requested a new report of shipped orders for which the order was placed on either a Saturday or a Sunday. Write a query which displays the order id, order date, shipped date, along with a calculated column labeled ?Order_Day? showing the day of the week the order was placed (use the DAYNAME function). Only display orders that have shipped and were placed on a Saturday or Sunday. Sort by order date with most recent orders at the top.

***Using SELECT DISTINCT and IN statements

2. Using the SUBSTRING and CONCAT functions, write a query to display each customer name as a single field in the format ?Jones, Tom? with a heading of Customer along with the customer_phone field in a nicely formatted calculated column named Phone. For example, a record containing the customer_phone value 6145535443 would be output with parentheses, spaces, and hyphens, like this: (614) 555-5443. Sort by last name.

Database Model for Labs 4-7 customers PK customer id INTEGER orders PK order id INTEGER customer_first_name VARCHAR(20) customerlast name VARCHAR(20) customer_address VARCHAR(50) customer_city customer_state customer_zip customer phone CHAR(10) customer fax order_date DATETIME shipped_date DATETIME VARCHAR(20) CHAR(2) CHAR(5) FK1 customer id INTEGER FK2 employee_id INTEGER CHAR(10) Employees order details id INTEGER PK,FK1 order id INTEGER PK,FK2 item idINTEGER last_name VARCHAR(20) first name VARCHAR(20) FK1 manager idINTEGER order qty INTEGER tems Artists PK item id INTEGER PK artist id INTEGER title unit_price DECIMAL(9,2) VARCHAR(40) artist_name VARCHAR(30) FK1 artist id INTEGER

customers PK customer id customer_city customer_state customer_zip customer_first_name VARCHAR(20) customer_last_name VARCHAR(20) customer_address VARCHAR(50) VARCHAR(20) PK INTEGER CHAR(2) CHAR(5) customer_phone CHAR(10) customer_fax CHAR(10) order_details PK,FK1 order_id INTEGER PK,FK2 item_id INTEGER order_qty INTEGER Database Model for Labs 4-7 items item_id INTEGER title VARCHAR(40) unit_price DECIMAL(9,2) FK1 artist_id INTEGER orders PK order_id INTEGER order_date DATETIME shipped_date DATETIME FK1 customer_id INTEGER FK2 employee_id INTEGER Artists OH -OHPK artist_id INTEGER PK FK1 artist_name VARCHAR(30) Employees employee id INTEGER last_name VARCHAR(20) first_name VARCHAR(20) manager_id INTEGER

Step by Step Solution

3.44 Rating (147 Votes )

There are 3 Steps involved in it

Step: 1

1 Select distinct orderid orderdate shippeddate DAY NAME orderdate as OrderDay ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managerial Decision Modeling With Spreadsheets

Authors: Nagraj Balakrishnan, Barry Render, Jr. Ralph M. Stair

3rd Edition

136115837, 978-0136115830

More Books

Students also viewed these Databases questions

Question

What is the factor rating method, and how does it work?

Answered: 1 week ago