Question: 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:

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:


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
Get step-by-step solutions from verified subject matter experts
