tuanbs

tuanbs

  • NA
  • 23
  • 102.7k

Could anyone help me with these queries?

May 26 2012 10:56 AM
I'm not good at database (oracle), please help me with these queries:
I have 4 tables and their definition:
1. A3_DW_PROD: (DW_PROD_ID, PRODID, PRODNAME, CATCODE, CATNAME, MCODE, MLOCATION, ALT_SKU_CODE)
2. A3_DW_CUST: (DW_CUST_ID, CUSTID, CUSTNAME, CUSTEMAIL, CUSTLOC)
3. A3_DW_SALES: (DW_PROD_ID, DW_CUST_ID, DW_DAY_ID, SALES_AMT, SALES_QTY)
4. A3_DW_TIME: (DW_DAY_ID, DAY_LONG, DAY_SHORT, DAY_NUM_OF_WEEK,
DAY_NUM_OF_MONTH, DAY_NUM_OF_YEAR, MONTH_SHORT,
MONTH_LONG, MONTH_NUM_OF_YEAR, WEEK_NUM_OF_YEAR,
QTR_NUM_OF_YEAR, YEAR_NO)


And the requirement of SQL queries are:
1. List the DW_CUST_ID, original customer Id, customer name and total DW_SALES_AMT for all sales. Only display totals that are less than $100,000. The list must be ascending total sequence.
2. List the DW_PROD_ID, product name, total DW_SALES_QTY and total DW_SALES_AMT for all sales. Only display totals that are greater than or equal to $100,000. The list must be descending total sequence.
3. List the Month Number, Month Name and total DW_SALES_AMT for all sales. The list must be ascending Month Number sequence.
4. List the DW_PROD_ID, original product id, product name and total DW_SALES_QTY. Only display totals for category code 'OFF'. The list must be descending total sequence.
5. List the category code category name and total DW_SALES_AMT. The list must be descending total sequence.
6. List the day of week number, day name and total number of sales. The list must be ascending day of week number sequence.
7. List the DW_PROD_ID, original product id, product name, total DW_SALES_QTY and rank number. Only show the top 3 rankings.
8. List the DW_CUST_ID, original customer Id, customer name and total DW_SALES_AMT of the customer with the largest total sales

Thank you so much.