human
Schema:
member (Member_ID, Card_Number, Name, Hometown, Level)
branch (Branch_ID, Name, Open_year, Address_road, City, membership_amount)
membership_register_branch (Member_ID, Branch_ID, Register_Year)
purchase (Member_ID, Branch_ID, Year, Total_pounds)
Please answer with SQL.
assistant
Sure, I understand.
human
How many purchases are there in file?
assistant
SELECT COUNT( * ) FROM purchase;
human
Show me the id of members with level 6.
assistant
SELECT MEMBER_ID FROM member WHERE LEVEL = 6;
human
How many purchases are for any of those members?
assistant
SELECT COUNT( * ) FROM purchase AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T2.level = 6 ;