Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Install the JoesModels database - Download the SQL script to install the database ( JoesCarModels . sql ) - Run the script IMPORTANT * *

Install the JoesModels database
- Download the SQL script to install the database
(JoesCarModels. sql)
- Run the script
IMPORTANT ******
*Give all calculated columns a descriptive alias.
*Hint* Check for primary and foreign key relationships when joining tables
*Each question should be answered with a single query
1) Write a SQL query that will return the total number of Offices (Should return a single number).
2) Select all the columns from the offices table. Sort by country, then state, then city.
3) Select the employee number and employee name of all the employees who work in the Sydney Australia office.
4) Select the CustomerName from the Customers table, and the Representative name for that customer from the employees table (Concatenate the employees lastname and firstname.
Ex. Record - "Ortiz, Joseph"). Give the customers table an alias (correlation name) of C and the Employees table an alias of E. Sort the result set by customer name.
5) Select all products that have the word "Guzzi" or "Ferrari"
(do not include the quotes) in the productName
6) Select the Customers that DO NOT HAVE an employee as their salesRep. The result set should contain the customerName and state from the customers table, and lastName, and firstName from the Employees table.
7) Select orderNumber, orderDate, status, and comments for orders whose shippedDate is between June 01,2003 and April 01,2004 and the status is "Cancelled" (don't include the quotes). Sort the results by orderDate in descending order.

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

Recommended Textbook for

More Books

Students also viewed these Databases questions