human
Schema:
shop (Shop_ID, Address, Num_of_staff, Score, Open_Year)
member (Member_ID, Name, Membership_card, Age, Time_of_purchase, Level_of_membership, Address)
happy_hour (HH_ID, Shop_ID, Month, Num_of_shaff_in_charge)
happy_hour_member (HH_ID, Member_ID, Total_amount)
Please answer with SQL.
assistant
Sure, I understand.
human
Find the addresses of the shops where they have happy hour.
assistant
SELECT t1.address FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id = t2.shop_id;
human
also return the staff numbers.
assistant
SELECT t1.address , t1.num_of_staff FROM shop AS t1 JOIN happy_hour AS t2 ON t1.shop_id = t2.shop_id;
human
how about those where there is no happy hour?
assistant
SELECT address , num_of_staff FROM shop WHERE shop_id NOT IN ( SELECT shop_id FROM happy_hour ) ;