adarshakb
09-27-2010, 06:37 AM
select order# from order_item o
where not exists
((select warehouse# from warehouse where city='Bidar')
minus
(select warehouse# from shippment s where s.order#=o.order#));
select * from order_item;
SELECT * FROM warehouse;
SELECT * FROM shippment;
ORDER#
5
ORDER# ITEM# QTY
1...........2...........5
1...........5...........4
2...........5...........3
3...........1...........4
4...........2...........8
5...........3...........2
6 rows selected.
WAREHOUSE# CITY
1......................Bidar
2......................Bagalkot
3 ......................Bijapur
4 ......................Bidar
5 ......................Bannerghatta
6 ......................Bidar
6 rows selected.
ORDER# WAREHOUSE# SHIP_DATE
1......................2 ...........02-JAN-90
1......................4 ...........02-JAN-90
2......................1...........03-JAN-90
3......................5...........04-JAN-90
4 ......................2...........05-JAN-90
5......................4...........06-JAN-90
5 ......................1...........06-JAN-90
5......................6...........06-JAN-90
-----------------------------------------------------------------
My question is:
Why/How 5 come in the 1st table as answer
(select warehouse# from warehouse where city='Bidar')
minus
(select warehouse# from shippment s where s.order#=o.order#)
return NULL
But still we get output as 5
and not as 1 2 3 4 5
where not exists
((select warehouse# from warehouse where city='Bidar')
minus
(select warehouse# from shippment s where s.order#=o.order#));
select * from order_item;
SELECT * FROM warehouse;
SELECT * FROM shippment;
ORDER#
5
ORDER# ITEM# QTY
1...........2...........5
1...........5...........4
2...........5...........3
3...........1...........4
4...........2...........8
5...........3...........2
6 rows selected.
WAREHOUSE# CITY
1......................Bidar
2......................Bagalkot
3 ......................Bijapur
4 ......................Bidar
5 ......................Bannerghatta
6 ......................Bidar
6 rows selected.
ORDER# WAREHOUSE# SHIP_DATE
1......................2 ...........02-JAN-90
1......................4 ...........02-JAN-90
2......................1...........03-JAN-90
3......................5...........04-JAN-90
4 ......................2...........05-JAN-90
5......................4...........06-JAN-90
5 ......................1...........06-JAN-90
5......................6...........06-JAN-90
-----------------------------------------------------------------
My question is:
Why/How 5 come in the 1st table as answer
(select warehouse# from warehouse where city='Bidar')
minus
(select warehouse# from shippment s where s.order#=o.order#)
return NULL
But still we get output as 5
and not as 1 2 3 4 5