Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SQL Help!!! QUESTION: Quite often we need created computed values. We don't want to store these in the database (unnecessary) so we often generated them

SQL Help!!!

QUESTION:Quite often we need created computed values. We don't want to store these in the database (unnecessary) so we often generated them "on the fly". Using your previous query, create new column that is the avereage order value (sum/total number of orders). Don't use the AVG() function. Your data should look like:

image text in transcribed

My Previous query was:

SELECT customer.c_name, customer.c_custkey, orders.O_ORDERDATE, orders.O_ORDERKEY, orders.O_TOTALPRICE

FROM customer

INNER JOIN orders on orders.O_CUSTKEY = customer.c_custkey

order by customer.c_custkey, customer.c_name, orders.O_ORDERDATE

ASC LIMIT 10

Photos of the database:

image text in transcribed

image text in transcribed

3. Quite often we need created computed values. We don't want to store these in the database (unnecessary) so we often generated them "on the fly Using your previous query, create new column that is the avereage order value (sum/total number of orders. Don't use the AVG0 function. Your data should look like: Customer 000000001 1 1428873.619 15876 3.734444 Customer 000000002 2 1156504.92 10 115650.492000 Customer 000000004 44134567.39 31 133373.141613 Customer 000000005 5 1084042.749 120449.1933 33 Customer 000000007 73922020.98 24 163417.5408 33 Where column 4 is the average order value. In your SELECT statement you can created this computed column by enclosing your "field math" in parenthesis field name/10 200)

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

4-3. How does an abstract word differ from a concrete word? [LO-4]

Answered: 1 week ago

Question

4-1. What is meant by the term you attitude? [LO-1]

Answered: 1 week ago