Can anyone help me out with this?

SalesPerson
Name Age PercentOfQuota Salary
Abel 24 63 120,000
Baker 56 38 42,000
Jones 34 26 36,000
Murphy 64 42 50,000
Zenith 45 59 118,000
Kobad 43 27 36,000

Order
Number CustName SalespersonName Amount
100 Abernathy Construction Zenith   560
200 Abernathy Construction Jones 1800
300 Manchester Lumber Abel   480
400 Amalgamated Housing Abel 2500
500 Abernathy Construction Murphy 6000
600 Tri-City Builders Abel   700
700 Manchester Lumber Jones   150

Customer
Name City Industry Type
Abernathy Construction Willow B
Manchester Lumber Manchester F
Tri-City Builders Memphis B
Amalgamated Housing Memphis B

Show relational algebra expressions for:
1) The City of all CUSTOMERS having an order with sales person Jones

2) The names of all the salespeople with the names of customers who have ordered from them. Include salespeople who have no orders.

cheers!!

Recommended Answers

All 4 Replies

What is "relational algebra"? Also what approaches have you tried? Post your queries here and what problems you are having with them and we will work from there.

Thanks for the responese.

I am thinking something like
1) SALESPERSON JOIN (Name='Jones') Where Customer [City]

2)SALESPERSON JOIN [Name] ORDER [Customer]

You think that this would work?

--1
Select Customer.City, Count(*) As OrderCount
From Order Inner Join Customer On (Order.CustName = Customer.Name)
Where Order.SalesPersonName = 'Jones'
Group By Customer.City
--2
Select SalesPerson.Name, IsNull(Order.CustName, 'No Orders') As CustomerName
From SalesPerson Left Join Order On (SalesPerson.Name = Order.SalesPersonName)

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.