SQL
stringlengths
18
577
question
stringlengths
317
11.5k
SELECT T2.dept_name , T2.dept_address , count(*) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 3
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the name, address, number of students in the departments that have the top 3 highest number of students.
SELECT T2.dept_name , T2.dept_address , count(*) FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 3
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the name, address, and number of students in the departments that have the 3 most students?
SELECT T1.emp_fname , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T3.dept_code = T2.dept_code WHERE T3.dept_name = 'History' AND T2.prof_high_degree = 'Ph.D.'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first name and office of the professor who is in the history department and has a Ph.D. degree.
SELECT T1.emp_fname , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T3.dept_code = T2.dept_code WHERE T3.dept_name = 'History' AND T2.prof_high_degree = 'Ph.D.'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names and office of the professors who are in the history department and have a Ph.D?
SELECT T2.emp_fname , T1.crs_code FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first names of all instructors who have taught some course and the course code.
SELECT T2.emp_fname , T1.crs_code FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names of all teachers who have taught a course and the corresponding course codes?
SELECT T2.emp_fname , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first names of all instructors who have taught some course and the course description.
SELECT T2.emp_fname , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names of all teachers who have taught a course and the corresponding descriptions?
SELECT T2.emp_fname , T4.prof_office , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first names and offices of all instructors who have taught some course and also find the course description.
SELECT T2.emp_fname , T4.prof_office , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names, office locations of all lecturers who have taught some course?
SELECT T2.emp_fname , T4.prof_office , T3.crs_description , T5.dept_name FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num JOIN department AS T5 ON T4.dept_code = T5.dept_code
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first names and offices of all instructors who have taught some course and the course description and the department name.
SELECT T2.emp_fname , T4.prof_office , T3.crs_description , T5.dept_name FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN professor AS T4 ON T2.emp_num = T4.emp_num JOIN department AS T5 ON T4.dept_code = T5.dept_code
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names, office locations, and departments of all instructors, and also what are the descriptions of the courses they teach?
SELECT T1.stu_fname , T1.stu_lname , T4.crs_description 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
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find names of all students who took some course and the course description.
SELECT T1.stu_fname , T1.stu_lname , T4.crs_description 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
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of all students who took a class and the corresponding course descriptions?
SELECT T1.stu_fname , T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'C' OR T2.enroll_grade = 'A'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find names of all students who took some course and got A or C.
SELECT T1.stu_fname , T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'C' OR T2.enroll_grade = 'A'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of all students taking a course who received an A or C?
SELECT T2.emp_fname , T1.class_room FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Accounting'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first names of all professors in the Accounting department who is teaching some course and the class room.
SELECT T2.emp_fname , T1.class_room FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Accounting'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names of all Accounting professors who teach and what are the classrooms of the courses they teach?
SELECT DISTINCT T2.emp_fname , T3.prof_high_degree FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Computer Info. Systems'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first names and degree of all professors who are teaching some class in Computer Info. Systems department.
SELECT DISTINCT T2.emp_fname , T3.prof_high_degree FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN professor AS T3 ON T2.emp_num = T3.emp_num JOIN department AS T4 ON T4.dept_code = T3.dept_code WHERE T4.dept_name = 'Computer Info. Systems'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the different first names and highest degree attained for professors teaching in the Computer Information Systems department?
SELECT T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'A' AND T2.class_code = 10018
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the last name of the student who got a grade A in the class with code 10018.
SELECT T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'A' AND T2.class_code = 10018
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the last name of the student who received an A in the class with the code 10018?
SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T1.dept_code = T3.dept_code WHERE T3.dept_name = 'History' AND T1.prof_high_degree != 'Ph.D.'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first name and office of history professor who did not get a Ph.D. degree.
SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T1.dept_code = T3.dept_code WHERE T3.dept_name = 'History' AND T1.prof_high_degree != 'Ph.D.'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names and offices of history professors who don't have Ph.D.s?
SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING count(*) > 1
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first names of professors who are teaching more than one class.
SELECT T2.emp_fname FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num GROUP BY T1.prof_num HAVING count(*) > 1
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names of all professors who teach more than one class?
SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num GROUP BY T2.stu_num HAVING count(*) = 1
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the first names of students who took exactly one class.
SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num GROUP BY T2.stu_num HAVING count(*) = 1
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the first names of student who only took one course?
SELECT T2.dept_name FROM course AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.crs_description LIKE '%Statistics%'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the name of department that offers the class whose description has the word "Statistics".
SELECT T2.dept_name FROM course AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.crs_description LIKE '%Statistics%'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the name of the department that offers a course that has a description including the word "Statistics"?
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 WHERE T3.crs_code = 'ACCT-211' AND T1.stu_lname LIKE 'S%'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the first name of the student whose last name starting with the letter S and is taking ACCT-211 class?
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 WHERE T3.crs_code = 'ACCT-211' AND T1.stu_lname LIKE 'S%'
Given the Table class having columns as CLASS_CODE has datatype text, CRS_CODE has datatype text, CLASS_SECTION has datatype text, CLASS_TIME has datatype text, CLASS_ROOM has datatype text, PROF_NUM has datatype number which has CLASS_CODE and Given the Table course having columns as CRS_CODE has datatype text, DEPT_CODE has datatype text, CRS_DESCRIPTION has datatype text, CRS_CREDIT has datatype number which has CRS_CODE and Given the Table department having columns as DEPT_CODE has datatype text, DEPT_NAME has datatype text, SCHOOL_CODE has datatype text, EMP_NUM has datatype number, DEPT_ADDRESS has datatype text, DEPT_EXTENSION has datatype text which has DEPT_CODE and Given the Table employee having columns as EMP_NUM has datatype number, EMP_LNAME has datatype text, EMP_FNAME has datatype text, EMP_INITIAL has datatype text, EMP_JOBCODE has datatype text, EMP_HIREDATE has datatype time, EMP_DOB has datatype time which has EMP_NUM and Given the Table enroll having columns as CLASS_CODE has datatype text, STU_NUM has datatype number, ENROLL_GRADE has datatype text which has STU_NUM and Given the Table professor having columns as EMP_NUM has datatype number, DEPT_CODE has datatype text, PROF_OFFICE has datatype text, PROF_EXTENSION has datatype text, PROF_HIGH_DEGREE has datatype text which has NO_PRIMARY_KEY and Given the Table student having columns as STU_NUM has datatype number, STU_LNAME has datatype text, STU_FNAME has datatype text, STU_INIT has datatype text, STU_DOB has datatype time, STU_HRS has datatype number, STU_CLASS has datatype text, STU_GPA has datatype number, STU_TRANSFER has datatype number, DEPT_CODE has datatype text, STU_PHONE has datatype text, PROF_NUM has datatype number which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the first name of the student whose last name starts with the letter S and is taking ACCT-211?
SELECT count(*) FROM club
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. How many clubs are there?
SELECT count(*) FROM club
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What is the total number of clubs?
SELECT DISTINCT Region FROM club ORDER BY Region ASC
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. List the distinct region of clubs in ascending alphabetical order.
SELECT DISTINCT Region FROM club ORDER BY Region ASC
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the different regions of clubs in ascending alphabetical order?
SELECT avg(Gold) FROM club_rank
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What is the average number of gold medals for clubs?
SELECT avg(Gold) FROM club_rank
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What is the average number of gold medals for a club?
SELECT Competition_type , Country FROM competition
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the types and countries of competitions?
SELECT Competition_type , Country FROM competition
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the types of every competition and in which countries are they located?
SELECT DISTINCT YEAR FROM competition WHERE Competition_type != "Tournament"
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the distinct years in which the competitions type is not "Tournament"?
SELECT DISTINCT YEAR FROM competition WHERE Competition_type != "Tournament"
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the different years for all competitions that are not of type equal to tournament?
SELECT max(Silver) , min(Silver) FROM club_rank
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the maximum and minimum number of silver medals for clubs.
SELECT max(Silver) , min(Silver) FROM club_rank
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the maximum and minimum number of silver medals for all the clubs?
SELECT count(*) FROM club_rank WHERE Total < 10
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. How many clubs have total medals less than 10?
SELECT count(*) FROM club_rank WHERE Total < 10
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What is the total number of clubs that have less than 10 medals in total?
SELECT name FROM club ORDER BY Start_year ASC
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. List all club names in ascending order of start year.
SELECT name FROM club ORDER BY Start_year ASC
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the names of all the clubs starting with the oldest?
SELECT name FROM club ORDER BY name DESC
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. List all club names in descending alphabetical order.
SELECT name FROM club ORDER BY name DESC
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the names of all the clubs ordered in descending alphabetical order?
SELECT T1.name , T2.Player_id FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. Please show the names and the players of clubs.
SELECT T1.name , T2.Player_id FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the names and players of all the clubs?
SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Position = "Right Wing"
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. Show the names of clubs that have players with position "Right Wing".
SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Position = "Right Wing"
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the names of the clubs that have players in the position of "Right Wing"?
SELECT avg(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = "AIB"
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What is the average points of players from club with name "AIB".
SELECT avg(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = "AIB"
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What is the average number of points for players from the "AIB" club?
SELECT POSITION , avg(Points) FROM player GROUP BY POSITION
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. List the position of players and the average number of points of players of each position.
SELECT POSITION , avg(Points) FROM player GROUP BY POSITION
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. For each position, what is the average number of points for players in that position?
SELECT POSITION FROM player GROUP BY name HAVING avg(Points) >= 20
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. List the position of players with average number of points scored by players of that position bigger than 20.
SELECT POSITION FROM player GROUP BY name HAVING avg(Points) >= 20
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the positions of players whose average number of points scored by that position is larger than 20?
SELECT Competition_type , COUNT(*) FROM competition GROUP BY Competition_type
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. List the types of competition and the number of competitions of each type.
SELECT Competition_type , COUNT(*) FROM competition GROUP BY Competition_type
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the types of competition and number of competitions for that type?
SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. List the most common type of competition.
SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What is the most common competition type?
SELECT Competition_type FROM competition GROUP BY Competition_type HAVING COUNT(*) <= 5
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. List the types of competition that have at most five competitions of that type.
SELECT Competition_type FROM competition GROUP BY Competition_type HAVING COUNT(*) <= 5
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the types of competition that have most 5 competitions for that type?
SELECT name FROM CLub WHERE Club_ID NOT IN (SELECT Club_ID FROM player)
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. List the names of clubs that do not have any players.
SELECT name FROM CLub WHERE Club_ID NOT IN (SELECT Club_ID FROM player)
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the names of all clubs that do not have any players?
SELECT POSITION FROM player WHERE Points > 20 INTERSECT SELECT POSITION FROM player WHERE Points < 10
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the positions with both players having more than 20 points and less than 10 points.
SELECT POSITION FROM player WHERE Points > 20 INTERSECT SELECT POSITION FROM player WHERE Points < 10
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the positions of both players that have more than 20 20 points and less than 10 points?
SELECT sum(Points) FROM player
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. Show total points of all players.
SELECT sum(Points) FROM player
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What is the total number of points for all players?
SELECT count(DISTINCT POSITION) FROM player
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. how many different positions are there?
SELECT count(DISTINCT POSITION) FROM player
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. How many different position for players are listed?
SELECT name FROM player WHERE points > (SELECT avg(points) FROM player)
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. what are the name of players who get more than the average points.
SELECT name FROM player WHERE points > (SELECT avg(points) FROM player)
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the names of all players that got more than the average number of points?
SELECT count(*) , POSITION FROM player WHERE points < 30 GROUP BY POSITION
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. find the number of players whose points are lower than 30 in each position.
SELECT count(*) , POSITION FROM player WHERE points < 30 GROUP BY POSITION
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What is the number of players who have points less than 30 for each position?
SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country ORDER BY count(*) DESC LIMIT 1
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. which country did participated in the most number of Tournament competitions?
SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country ORDER BY count(*) DESC LIMIT 1
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. what is the name of the country that participated in the most tournament competitions?
SELECT country FROM competition WHERE competition_type = 'Friendly' INTERSECT SELECT country FROM competition WHERE competition_type = 'Tournament'
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. which countries did participated in both Friendly and Tournament type competitions.
SELECT country FROM competition WHERE competition_type = 'Friendly' INTERSECT SELECT country FROM competition WHERE competition_type = 'Tournament'
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the countries that participated in both friendly and tournament type competitions?
SELECT country FROM competition EXCEPT SELECT country FROM competition WHERE competition_type = 'Friendly'
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. Find the countries that have never participated in any competition with Friendly type.
SELECT country FROM competition EXCEPT SELECT country FROM competition WHERE competition_type = 'Friendly'
Given the Table club having columns as Club_ID has datatype number, name has datatype text, Region has datatype text, Start_year has datatype text which has Club_ID and Given the Table club rank having columns as Rank has datatype number, Club_ID has datatype number, Gold has datatype number, Silver has datatype number, Bronze has datatype number, Total has datatype number which has Rank and Given the Table player having columns as Player_ID has datatype number, name has datatype text, Position has datatype text, Club_ID has datatype number, Apps has datatype number, Tries has datatype number, Goals has datatype text, Points has datatype number which has Player_ID and Given the Table competition having columns as Competition_ID has datatype number, Year has datatype number, Competition_type has datatype text, Country has datatype text which has Competition_ID and Given the Table competition result having columns as Competition_ID has datatype number, Club_ID_1 has datatype number, Club_ID_2 has datatype number, Score has datatype text which has Competition_ID. Answer the question by writing the appropriate SQL code. What are the countries that have never participated in any friendly-type competitions?
SELECT sum(num_of_component) FROM furniture
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. How many furniture components are there in total?
SELECT name , furniture_id FROM furniture ORDER BY market_rate DESC LIMIT 1
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. Return the name and id of the furniture with the highest market rate.
SELECT sum(market_rate) FROM furniture ORDER BY market_rate DESC LIMIT 2
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. find the total market rate of the furnitures that have the top 2 market shares.
SELECT Num_of_Component , name FROM furniture WHERE Num_of_Component > 10
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. Find the component amounts and names of all furnitures that have more than 10 components.
SELECT name , Num_of_Component FROM furniture ORDER BY market_rate LIMIT 1
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. Find the name and component amount of the least popular furniture.
SELECT t1.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID WHERE t2.Price_in_Dollar < (SELECT max(Price_in_Dollar) FROM furniture_manufacte)
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. Find the names of furnitures whose prices are lower than the highest price.
SELECT open_year , name FROM manufacturer ORDER BY num_of_shops DESC LIMIT 1
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. Which manufacturer has the most number of shops? List its name and year of opening.
SELECT avg(Num_of_Factories) FROM manufacturer WHERE num_of_shops > 20
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. Find the average number of factories for the manufacturers that have more than 20 shops.
SELECT name , manufacturer_id FROM manufacturer ORDER BY open_year
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. List all manufacturer names and ids ordered by their opening year.
SELECT name , open_year FROM manufacturer WHERE num_of_shops > 10 OR Num_of_Factories < 10
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. Give me the name and year of opening of the manufacturers that have either less than 10 factories or more than 10 shops.
SELECT max(num_of_shops) , avg(Num_of_Factories) FROM manufacturer WHERE open_year < 1990
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. what is the average number of factories and maximum number of shops for manufacturers that opened before 1990.
SELECT t1.manufacturer_id , t1.num_of_shops FROM manufacturer AS t1 JOIN furniture_manufacte AS t2 ON t1.manufacturer_id = t2.manufacturer_id ORDER BY t2.Price_in_Dollar DESC LIMIT 1
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. Find the id and number of shops for the company that produces the most expensive furniture.
SELECT count(*) , t1.name FROM manufacturer AS t1 JOIN furniture_manufacte AS t2 ON t1.manufacturer_id = t2.manufacturer_id GROUP BY t1.manufacturer_id
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. Find the number of funiture types produced by each manufacturer as well as the company names.
SELECT t1.name , t2.price_in_dollar FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. Give me the names and prices of furnitures which some companies are manufacturing.
SELECT Market_Rate , name FROM furniture WHERE Furniture_ID NOT IN (SELECT Furniture_ID FROM furniture_manufacte)
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. Find the market shares and names of furnitures which no any company is producing in our records.
SELECT t3.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID JOIN manufacturer AS t3 ON t2.manufacturer_id = t3.manufacturer_id WHERE t1.num_of_component < 6 INTERSECT SELECT t3.name FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID JOIN manufacturer AS t3 ON t2.manufacturer_id = t3.manufacturer_id WHERE t1.num_of_component > 10
Given the Table manufacturer having columns as Manufacturer_ID has datatype number, Open_Year has datatype number, Name has datatype text, Num_of_Factories has datatype number, Num_of_Shops has datatype number which has Manufacturer_ID and Given the Table furniture having columns as Furniture_ID has datatype number, Name has datatype text, Num_of_Component has datatype number, Market_Rate has datatype number which has Furniture_ID and Given the Table furniture manufacte having columns as Manufacturer_ID has datatype number, Furniture_ID has datatype number, Price_in_Dollar has datatype number which has Manufacturer_ID. Answer the question by writing the appropriate SQL code. Find the name of the company that produces both furnitures with less than 6 components and furnitures with more than 10 components.