CREATE TABLE CLASS (class_code VARCHAR(255), crs_code VARCHAR(255)); CREATE TABLE enroll (stu_num VARCHAR(255), class_code VARCHAR(255)); CREATE TABLE department (dept_code VARCHAR(255), dept_name VARCHAR(255)); CREATE TABLE course (crs_code VARCHAR(255), dept_code VARCHAR(255)); CREATE TABLE student (stu_fname VARCHAR(255), stu_num VARCHAR(255))
Find the first name of student who is taking classes from accounting and Computer Info. Systems departments
    
SQL: SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Accounting' INTERSECT SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Computer Info. Systems'