group by, having? distinct,...subquery [message #375186] |
Thu, 02 August 2001 19:18 |
tony nelson
Messages: 1 Registered: August 2001
|
Junior Member |
|
|
Hello,
I need a slight help on writing this. I assume it should be a subquery, but am unable to get the right format. Below is my table structure and data with select * statements. the question i need answered is as follows:
Show the names and ages of salespeople who have an order with all customers?
SQL> desc salesperson
Name Null? Type
------------------------------- -------- ----
NAME NOT NULL VARCHAR2(20)
AGE NUMBER(3)
SALARY NUMBER(9,2)
SQL> desc salesorder;
Name Null? Type
------------------------------- -------- ----
ID NOT NULL NUMBER(3)
CUSTNAME VARCHAR2(30)
NAME VARCHAR2(20)
AMOUNT NUMBER(9,2)
SQL> select * from salesperson;
NAME AGE SALARY
-------------------- --------- ---------
Abel 63 120000
Baker 38 42000
Jones 26 45000
Murphy 42 50000
Zenith 59 118000
Kobad 27 34000
Nelson 39
7 rows selected.
SQL> select * from salesorder;
ID CUSTNAME NAME AMOUNT
--------- ------------------------------ -------------------- ---------
100 ABC Construction Zenith 560
200 ABC Construction Jones 1800
300 Manchester Lumber Abel 480
400 Amalgamated Housing Abel 2500
600 Tri-City Builders Abel 700
700 Manchester Lumbeer Jones 150
6 rows selected.
SQL>
|
|
|