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
show all info about members.
assistant
SELECT * FROM member;
human
which of them are older than 40?
assistant
SELECT * FROM member WHERE age > 40;
human
for those who are younger than 30?
assistant
SELECT * FROM member WHERE age < 30;
human
Which addresses have members in both groups?
assistant
SELECT address FROM member WHERE age < 30 INTERSECT SELECT address FROM member WHERE age > 40 ;