Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL STATEMENTS.

Status
Not open for further replies.

segel

IS-IT--Management
Mar 12, 2001
1
CA
Hi,
I have to write an SQL Statement to retrieve some information, the following are the databases:

Lives (person-name, street, city)
Works (person-name, company-name, salary)
Located-in (company-name, city)
manages (person-name, manager-name)

Question 1: Find all employees who live in the same city as the company they work for.
Question 2: Find all employees who live in the same city and on the same street as their manager.
Question 3: Find all employees who earn more than every employee of Small Bank Corporation
I believe the statement for #3 is:
Select Person-name
From Work
Where Salary> (Select Salary
From Work
Where Salary = "Small Bank Corporation"
Thanks in advance for any help.
Segel
 
I suppsoe you have Access avaiable?
If so create your four tables and put 1 or 2 records each.
then create a query that has the cities linked (for Question1).
Run it, so it works OK. then click on the SQL view of your query. There lies your SQL code for your program.

do the same for the other 2 questions DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top