Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MYSQL DATABASE: 1) Using a simple equijoin (joined using the WHERE clause) or INNER JOIN syntax, write a SQL statement to return customer name (cust_name)

MYSQL DATABASE:

1) Using a simple equijoin (joined using the WHERE clause) or INNER JOIN syntax, write a SQL statement to return customer name (cust_name) from the Customers table and related order numbers (order_num) from the Orders table, sorting the result by customer name and then by order number.

2)lets make the previous exercise more useful. In addition to returning the customer name and order number, add a third column named OrderTotal containing the total price of each order. There are two ways to do this, you can create the OrderTotal column using a subquery on the OrderItems table, or you can join the OrderItems table to the existing tables and use an aggregate function. Heres a hint, watch out for where you need to use fully qualified column names.

orders table:

order_num int(11) PK
order_date datetime
cust_id char(10)

customers table:

Columns:

cust_id char(10) PK
cust_name char(50)
cust_address char(50)
cust_city char(50)
cust_state char(5)
cust_zip char(10)
cust_country char(50)
cust_contact char(50)
cust_email

char(255)

orders item table:

order_num int(11) PK
order_item int(11) PK
prod_id char(10)
quantity int(11)
item_price decimal(8,2)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Students also viewed these Databases questions

Question

5. Under what conditions do groups outperform individuals?

Answered: 1 week ago

Question

4. Does cultural aptitude impact ones emotional intelligence?

Answered: 1 week ago

Question

7. Do the organizations social activities reflect diversity?

Answered: 1 week ago