Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Help to Learn SQL

Author  Topic 

pop199816
Starting Member

1 Post

Posted - 2009-04-08 : 01:48:37
Can anybody help me on the following, thanks :

All the queries are based on following 2 tables:

SQL> desc temp_customer_master
Name Null? Type
------------------------------- -------- ----
CUSTOMER_ID NOT NULL NUMBER --PRIMARY KEY
CUSTOMER_NAME NOT NULL VARCHAR2(50)
CUSTOMER_COUNTRY NOT NULL VARCHAR2(3)
CUSTOMER_STATE NOT NULL VARCHAR2(50)

SQL> desc temp_purchase_order
Name Null? Type
------------------------------- -------- ----
PURCHASE_ORDER_ID NOT NULL NUMBER --PRIMARY KEY
CUSTOMER_ID NOT NULL NUMBER --FOREIGN KEY TO temp_customer_master
PRODUCT_ID NOT NULL NUMBER
QUANTITY NOT NULL NUMBER
PRICE NOT NULL NUMBER
SUBTOTAL NOT NULL NUMBER
TAX NUMBER
ORDER_TOTAL NOT NULL NUMBER
PURCHASE_ORDER_DATE NOT NULL DATE --STORES DATE WITH TIMESTAMP

1) Find number of purchase orders created (based on Purchase_Order_Date) today.

2) Find total sales (based on order_total) for product_id = 'X', in 'WA' state, for year 2000.

3) List top 10 states by total sales (based on order total) for year 2001.


DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2009-04-08 : 12:33:11
What have you tried so far?

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL or How to sell Used Cars
For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -