Question: How will be those SQL functions write down The Table Name is: How many rows are in the Orders table? (Hint: Look up COUNT function)

How will be those SQL functions write down

The Table Name is:How will be those SQL functions write down The Table Name is:

  1. How many rows are in the Orders table? (Hint: Look up COUNT function)

  2. List all columns in the Orders table in reverse numerical order (from largest to smallest) by order number. Limit the output to the first 5 rows.

  3. What are the earliest and latest order dates in the Orders table? (Hint: Lookup MAX and MIN functions)

  4. List employee first names in alphabetical order along with a count of employees that have each first name. (Hint: you will need GROUP BY and ORDER BY clauses.)

  5. What orders do not have a status of Cancelled? Sort by order number. (Hint: Use the not equals operator.)

  6. Update Steve Pattersons first name to Steven in the employees table. Ensure that your update will not change a person whose first name is Steve but whose last name is not Patterson and will not change a person whose last name is Patterson but whose first name is not Steve. (There will be no results grid for this question.)

  7. List customer name, contact last name, contact first name, phone, city, and credit limit for customers in the cities of Paris or Lyon in France and who have a credit limit between 100000 and 130000. Do not assume that city names are unique. There can be cities with the same name in different countries. (Hint: Remember to use parentheses in the WHERE clause if you have both ANDs and ORs.)

  8. List the year, month and total $ amount of payments for each month. Order by year and month. (Hint: Make sure you get payments, not orders. Also make sure to get total payments, not individual payments.)

  9. What is the average payment $ amount?

  10. Add a new table called Dates to the classicmodels schema with the following columns:

Column

Primary Key

Data Type

Optional

FullDate

Yes

Date

No

MonthName

No

3 characters

No

YearNumber

No

Integer

No

QuarterNumber

No

Integer

No

Notes

No

Variable, up to 150 characters

Yes

Make sure all the properties of the columns required above are implemented in your SQL statement. You may NOT use the pop-up menu in the schema list to create the table. You must write your SQL statement from scratch and include a screenshot of the entire statement below.

  1. Which month(s) in what year(s) from question 8 have the highest payment total amount? Your query may not use a LIMIT clause. It must work if there are any number of months tied for the highest payment total amount. It must not produce any output for a month that is not the highest payment total or tied for the highest payment total.

2 3 st 5 classicmodels Tables customers employees offices orderdetails orders payments productlines products Views Stored Procedures Functions sys 2 3 st 5 classicmodels Tables customers employees offices orderdetails orders payments productlines products Views Stored Procedures Functions sys

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!