Professional Documents
Culture Documents
20150427120434nota SQL
20150427120434nota SQL
a. The following tables form part of a database held in a relational DBMS. Based on the
following table structure, create SQL statement for each of the following questions.
SALESPERSON
SalesID
1
2
3
4
5
6
Name
Abel
Baker
Jones
Murphy
Zenith
Kobad
Age
63
38
26
42
59
27
Salary
120,000
42,000
36,000
50,000
118,000
34,000
ORDER
OrderNo
CustName
100
200
300
400
500
600
700
10
10
20
40
10
30
20
CUSTOMER
CustID
10
20
30
40
SalespersonNa
me
5
3
1
1
4
1
3
Name
Abernathy Construction
Manchester Lumber
Tri-City Builders
Amalgamated Housing
Amount
560
1800
480
2500
6000
700
150
City
Willow
Manchester
Memphis
Memphis
IndustryType
B
F
B
B
Name
Abel
Baker
Jones
Kobad
Murphy
Zenith
Age
63
38
26
27
42
59
Salary
120,000
42,000
36,000
34,000
50,000
118,000
iii.
Compute the number of Customer(s) that make orders more than 1000.
Amount
8360
2500
iv. Show the names and salary of all Salesperson who do not have an order with
Abernathy Construction.
Select distinct s.name, s.salary
from salesperson s, order o
where s.name=o.salespersonName
AND o.custName != Abernathy Construction;
SALESPERSON
Name
Salary
Abel
120,000
Jones
36,000
v.Show the age of Salesperson who have an order with a Customer in Memphis.
vii.
Insert new record into table Customer using the following data:
Name = WestCourt Furniture
City = London
Industry Type = F
Change the record of Salesperson named Jones into new data as following:
Name = Parks
Age = 30