-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathORACLE_Exercise 10.txt
More file actions
24 lines (21 loc) · 906 Bytes
/
ORACLE_Exercise 10.txt
File metadata and controls
24 lines (21 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
1) Write a query that produces all pairs of salespeople who are living in the same city.
Exclude combinations of salespeople with themselves as well as duplicate rows with the order reversed.
SELECT A.SNAME, B.CITY FROM SALESPEOPLE A, SALESPEOPLE B
WHERE A.SNAME!=B.SNAME AND A.CITY=B.CITY;
----->
SNAME CITY
---------- ----------
MOTIKA LONDON
PEEL LONDON
==========================================================================================================================
2) Write a query that produces the names and cities of all customers with the same rating as Hoffman.
SELECT CNAME, CITY, RATING FROM CUSTOMERS
WHERE RATING=
(SELECT RATING FROM CUSTOMERS
WHERE CNAME='HOFFMAN');
----->
CNAME CITY RATING
---------- ---------- ----------
HOFFMAN LONDON 100
CLEMENS LONDON 100
PEREIRA ROME 100