0% found this document useful (0 votes)
2 views

Assignment SQL Lab2

The document contains a sales database with tables for salesman, customer, orders, company, item, emp_department, and emp_details. It also includes five SQL queries to extract specific information such as matching cities between salesmen and customers, order details within a certain amount range, and lists of customers based on salesman commission and city discrepancies. The queries aim to analyze relationships between salesmen, customers, and their respective orders and commissions.

Uploaded by

Luvsingh Rajput
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Assignment SQL Lab2

The document contains a sales database with tables for salesman, customer, orders, company, item, emp_department, and emp_details. It also includes five SQL queries to extract specific information such as matching cities between salesmen and customers, order details within a certain amount range, and lists of customers based on salesman commission and city discrepancies. The queries aim to analyze relationships between salesmen, customers, and their respective orders and commissions.

Uploaded by

Luvsingh Rajput
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Refer following Sales Database

table: salesman

salesman_id name city commission


----------- ---------- ---------- ----------
5001 James Hoog New York 0.15
5002 Nail Knite Paris 0.13
5005 Pit AlexLondon 0.11
5006 Mc Lyon Paris 0.14
5003 Lauson Hen 0.12
5007 Paul Adam Rome 0.13

table: customer

customer_id cust_name city grade salesman_id


----------- ------------ ---------- ---------- -----------
3002 Nick Rimando New York 100 5001
3005 Graham Zusi California 200 5002
3001 Brad Guzan London 5005
3004 Fabian Johns Paris 300 5006
3007 Brad Davis New York 200 5001
3009 Geoff Camero Berlin 100 5003
3008 Julian Green London 300 5002
3003 Jozy Altidor Moscow 200 5007

Table: orders

ord_no purch_amt ord_date customer_id salesman_id


---------- ---------- ---------- ----------- -----------
70001 150.5 2012-10-05 3005 5002
70009 270.65 2012-09-10 3001 5005
70002 65.26 2012-10-05 3002 5001
70004 110.5 2012-08-17 3009 5003
70007 948.5 2012-09-10 3005 5002
70005 2400.6 2012-07-27 3007 5001
70008 5760 2012-09-10 3002 5001
70010 1983.43 2012-10-10 3004 5006
70003 2480.4 2012-10-10 3009 5003
70012 250.45 2012-06-27 3008 5002
70011 75.29 2012-08-17 3003 5007
70013 3045.6 2012-04-25 3002 5001
Table: company_mast

COM_ID COM_NAME
------ -------------
11 Samsung
12 iBall
13 Epsion
14 Zebronics
15 Asus
16 Frontech

Table: item_mast

PRO_ID PRO_NAME PRO_PRICE PRO_COM


------- ------------------------- ---------- ----------
101 Mother Board 3200 15
102 Key Board 450 16
103 ZIP drive 250 14
104 Speaker 550 16
105 Monitor 5000 11
106 DVD drive 900 12
107 CD drive 800 12
108 Printer 2600 13
109 Refill cartridge 350 13
110 Mouse 250 12

Table: emp_department

DPT_CODE DPT_NAME DPT_ALLOTMENT


-------- --------------- -------------
57 IT 65000
63 Finance 15000
47 HR 240000
27 RD 55000
89 QC 75000

Table: emp_details

EMP_IDNO EMP_FNAME EMP_LNAME EMP_DEPT


--------- --------------- --------------- ----------
127323 Michale Robbin 57
526689 Carlos Snares 63
843795 Enric Dosio 57
328717 Jhon Snares 63
444527 Joseph Dosni 47
659831 Zanifer Emily 47
847674 Kuleswar Sitaraman 57
748681 Henrey Gabriel 47
555935 Alex Manuel 57
539569 George Mardy 27
733843 Mario Saule 63
631548 Alan Snappy 27
839139 Maria Foster 57

1. Write a SQL statement to prepare a list with salesman name, customer name and their cities for
the salesmen and customer who belongs to the same city.

2. Write a SQL statement to make a list with order no, purchase amount, customer name and their
cities for those orders which order amount between 500 and 2000.

3. Write a SQL statement to know which salesman are working for which customer.

4. Write a SQL statement to find the list of customers who appointed a salesman for their jobs who
gets a commission from the company is more than 12%.

5. Write a SQL statement to find the list of customers who appointed a salesman for their jobs who
does not live in the same city where their customer lives, and gets a commission is above 12% .

You might also like