use raj
select id, name, sum(amount) TOTAL_SALES
from CUSTOMERS, ORDERS
where id = customer_id
group by id, name;
select id, name, count(oid) NUMBER_OF_ORDERS
from CUSTOMERS, ORDERS
where id = customer_id
group by id, name;
select id, name, count(oid) NUMBER_OF_ORDERS
from CUSTOMERS, ORDERS
where id = customer_id
group by id, name
having count(oid) > 2;
select count(*) from customers
show tables
select bcode, sum(cap) NUM_SEATS
from room
group by bcode;
select bcode from building
select bcode, 0
from building
where bcode not in
(select distinct bcode
from room);
select distinct bcode
from room;
select bcode, sum(cap) NUM_SEATS
from room
group by bcode
union
select bcode, 0
from building
where bcode not in
(select distinct bcode
from room);
SELECT ID, NAME, SALARY
FROM CUSTOMERS
WHERE SALARY > 2000 AND age < 25;
select * from customers