Question:
List the codes of all courses that take place in room KLR209.
Additional table information: table: college_1

Answer: SELECT class_code FROM CLASS WHERE class_room = 'KLR209'


Question:
What are the codes of all the courses that are located in room KLR209?
Additional table information: table: college_1

Answer: SELECT class_code FROM CLASS WHERE class_room = 'KLR209'


Question:
List the first name of all employees with job code PROF ordered by their date of birth.
Additional table information: table: college_1

Answer: SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob NULLS FIRST


Question:
What are the first names of all employees that are professors ordered by date of birth?
Additional table information: table: college_1

Answer: SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob NULLS FIRST


Question:
Find the first names and offices of all professors sorted by alphabetical order of their first name.
Additional table information: table: college_1

Answer: SELECT T2.emp_fname, T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname NULLS FIRST


Question:
What are the first names and office locations for all professors sorted alphabetically by first name?
Additional table information: table: college_1

Answer: SELECT T2.emp_fname, T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname NULLS FIRST


Question:
What is the first and last name of the oldest employee?
Additional table information: table: college_1

Answer: SELECT emp_fname, emp_lname FROM employee ORDER BY emp_dob NULLS FIRST LIMIT 1


Question:
What are the first and last names of the employee with the earliest date of birth?
Additional table information: table: college_1

Answer: SELECT emp_fname, emp_lname FROM employee ORDER BY emp_dob NULLS FIRST LIMIT 1


Question:
What is the first, last name, gpa of the youngest one among students whose GPA is above 3?
Additional table information: table: college_1

Answer: SELECT stu_fname, stu_lname, stu_gpa FROM student WHERE stu_gpa > 3 ORDER BY stu_dob DESC LIMIT 1


Question:
What is the first and last name of the youngest student with a GPA above 3, and what is their GPA?
Additional table information: table: college_1

Answer: SELECT stu_fname, stu_lname, stu_gpa FROM student WHERE stu_gpa > 3 ORDER BY stu_dob DESC LIMIT 1


Question:
What is the first name of students who got grade C in any class?
Additional table information: table: college_1

Answer: SELECT DISTINCT stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE enroll_grade = 'C'


Question:
What are the first names of all students who got a grade C in a class?
Additional table information: table: college_1

Answer: SELECT DISTINCT stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE enroll_grade = 'C'


Question:
What is the name of department where has the smallest number of professors?
Additional table information: table: college_1

Answer: SELECT T2.dept_name FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What is the name of the department with the fewest professors?
Additional table information: table: college_1

Answer: SELECT T2.dept_name FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.dept_code ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What is the name of department where has the largest number of professors with a Ph.D. degree?
Additional table information: table: college_1

Answer: SELECT T2.dept_name, T1.dept_code FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.prof_high_degree = 'Ph.D.' GROUP BY T1.dept_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which department has the most professors with a Ph.D.?
Additional table information: table: college_1

Answer: SELECT T2.dept_name, T1.dept_code FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.prof_high_degree = 'Ph.D.' GROUP BY T1.dept_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the first names of the professors who do not teach a class.
Additional table information: table: college_1

Answer: SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' EXCEPT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num


Question:
What are the first names of all professors not teaching any classes?
Additional table information: table: college_1

Answer: SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' EXCEPT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num


Question:
What is the first names of the professors from the history department who do not teach a class.
Additional table information: table: college_1

Answer: SELECT T1.emp_fname FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' EXCEPT SELECT T4.emp_fname FROM employee AS T4 JOIN CLASS AS T5 ON T4.emp_num = T5.prof_num


Question:
What are the first names of all history professors who do not teach?
Additional table information: table: college_1

Answer: SELECT T1.emp_fname FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History' EXCEPT SELECT T4.emp_fname FROM employee AS T4 JOIN CLASS AS T5 ON T4.emp_num = T5.prof_num


Question:
What is the last name and office of the professor from the history department?
Additional table information: table: college_1

Answer: SELECT T1.emp_lname, T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History'


Question:
What are the last name and office of all history professors?
Additional table information: table: college_1

Answer: SELECT T1.emp_lname, T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T3.dept_name = 'History'


Question:
What is department name and office for the professor whose last name is Heffington?
Additional table information: table: college_1

Answer: SELECT T3.dept_name, T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T1.emp_lname = 'Heffington'


Question:
What is the name of the department and office location for the professor with the last name of Heffington?
Additional table information: table: college_1

Answer: SELECT T3.dept_name, T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T2.dept_code = T3.dept_code WHERE T1.emp_lname = 'Heffington'


Question:
Find the last name and hire date of the professor who is in office DRE 102.
Additional table information: table: college_1

Answer: SELECT T1.emp_lname, T1.emp_hiredate FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num WHERE T2.prof_office = 'DRE 102'


Question:
What is the last name of the professor whose office is located in DRE 102, and when were they hired?
Additional table information: table: college_1

Answer: SELECT T1.emp_lname, T1.emp_hiredate FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num WHERE T2.prof_office = 'DRE 102'


Question:
What is the code of the course which the student whose last name is Smithson took?
Additional table information: table: college_1

Answer: SELECT T1.crs_code FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num WHERE T3.stu_lname = 'Smithson'


Question:
What are the course codes for every class that the student with the last name Smithson took?
Additional table information: table: college_1

Answer: SELECT T1.crs_code FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num WHERE T3.stu_lname = 'Smithson'


Question:
What are the description and credit of the course which the student whose last name is Smithson took?
Additional table information: table: college_1

Answer: SELECT T4.crs_description, T4.crs_credit FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num JOIN course AS T4 ON T4.crs_code = T1.crs_code WHERE T3.stu_lname = 'Smithson'


Question:
How many credits is the course that the student with the last name Smithson took, and what is its description?
Additional table information: table: college_1

Answer: SELECT T4.crs_description, T4.crs_credit FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T3.stu_num = T2.stu_num JOIN course AS T4 ON T4.crs_code = T1.crs_code WHERE T3.stu_lname = 'Smithson'


Question:
How many professors who has a either Ph.D. or MA degree?
Additional table information: table: college_1

Answer: SELECT COUNT(*) FROM professor WHERE prof_high_degree = 'Ph.D.' OR prof_high_degree = 'MA'


Question:
How many professors attained either Ph.D. or Masters degrees?
Additional table information: table: college_1

Answer: SELECT COUNT(*) FROM professor WHERE prof_high_degree = 'Ph.D.' OR prof_high_degree = 'MA'


Question:
How many professors who are from either Accounting or Biology department?
Additional table information: table: college_1

Answer: SELECT COUNT(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T2.dept_name = 'Accounting' OR T2.dept_name = 'Biology'


Question:
What is the number of professors who are in the Accounting or Biology departments?
Additional table information: table: college_1

Answer: SELECT COUNT(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T2.dept_name = 'Accounting' OR T2.dept_name = 'Biology'


Question:
Find the first name of the professor who is teaching two courses with code CIS-220 and QM-261.
Additional table information: table: college_1

Answer: SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'CIS-220' INTERSECT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'QM-261'


Question:
What is the first name of the professor who is teaching CIS-220 and QM-261?
Additional table information: table: college_1

Answer: SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'CIS-220' INTERSECT SELECT T1.emp_fname FROM employee AS T1 JOIN CLASS AS T2 ON T1.emp_num = T2.prof_num WHERE crs_code = 'QM-261'


Question:
Find the first name of student who is taking classes from accounting and Computer Info. Systems departments
Additional table information: table: college_1

Answer: SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Accounting' INTERSECT SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Computer Info. Systems'


Question:
What are the first names of all students taking accoutning and Computer Information Systems classes?
Additional table information: table: college_1

Answer: SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Accounting' INTERSECT SELECT T1.stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Computer Info. Systems'


Question:
What is the average gpa of the students enrolled in the course with code ACCT-211?
Additional table information: table: college_1

Answer: SELECT AVG(T2.stu_gpa) FROM enroll AS T1 JOIN student AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T1.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211'


Question:
What is the average GPA of students taking ACCT-211?
Additional table information: table: college_1

Answer: SELECT AVG(T2.stu_gpa) FROM enroll AS T1 JOIN student AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T1.class_code = T3.class_code WHERE T3.crs_code = 'ACCT-211'


Question:
What is the first name, gpa and phone number of the top 5 students with highest gpa?
Additional table information: table: college_1

Answer: SELECT stu_gpa, stu_phone, stu_fname FROM student ORDER BY stu_gpa DESC LIMIT 5


Question:
What is the first name, GPA, and phone number of the students with the top 5 GPAs?
Additional table information: table: college_1

Answer: SELECT stu_gpa, stu_phone, stu_fname FROM student ORDER BY stu_gpa DESC LIMIT 5


Question:
What is the department name of the students with lowest gpa belongs to?
Additional table information: table: college_1

Answer: SELECT T2.dept_name FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code ORDER BY stu_gpa NULLS FIRST LIMIT 1


Question:
What is the name of the department with the student that has the lowest GPA?
Additional table information: table: college_1

Answer: SELECT T2.dept_name FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code ORDER BY stu_gpa NULLS FIRST LIMIT 1


Question:
Find the first name and gpa of the students whose gpa is lower than the average gpa of all students.
Additional table information: table: college_1

Answer: SELECT stu_fname, stu_gpa FROM student WHERE stu_gpa < (SELECT AVG(stu_gpa) FROM student)


Question:
What is the first name and GPA of every student that has a GPA lower than average?
Additional table information: table: college_1

Answer: SELECT stu_fname, stu_gpa FROM student WHERE stu_gpa < (SELECT AVG(stu_gpa) FROM student)


Question:
Find the name and address of the department that has the highest number of students.
Additional table information: table: college_1

Answer: SELECT T2.dept_name, T2.dept_address 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 1


Question:
What is the name and address of the department with the most students?
Additional table information: table: college_1

Answer: SELECT T2.dept_name, T2.dept_address 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 1


Question:
Find the name, address, number of students in the departments that have the top 3 highest number of students.
Additional table information: table: college_1

Answer: 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


Question:
What is the name, address, and number of students in the departments that have the 3 most students?
Additional table information: table: college_1

Answer: 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


Question:
Find the first name and office of the professor who is in the history department and has a Ph.D. degree.
Additional table information: table: college_1

Answer: 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.'


Question:
What are the first names and office of the professors who are in the history department and have a Ph.D?
Additional table information: table: college_1

Answer: 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.'


Question:
Find the first names of all instructors who have taught some course and the course code.
Additional table information: table: college_1

Answer: SELECT T2.emp_fname, T1.crs_code FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num


Question:
What are the first names of all teachers who have taught a course and the corresponding course codes?
Additional table information: table: college_1

Answer: SELECT T2.emp_fname, T1.crs_code FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num


Question:
Find the first names of all instructors who have taught some course and the course description.
Additional table information: table: college_1

Answer: 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


Question:
What are the first names of all teachers who have taught a course and the corresponding descriptions?
Additional table information: table: college_1

Answer: 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


Question:
Find the first names and offices of all instructors who have taught some course and also find the course description.
Additional table information: table: college_1

Answer: 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


Question:
What are the first names, office locations of all lecturers who have taught some course?
Additional table information: table: college_1

Answer: 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


Question:
Find the first names and offices of all instructors who have taught some course and the course description and the department name.
Additional table information: table: college_1

Answer: 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


Question:
What are the first names, office locations, and departments of all instructors, and also what are the descriptions of the courses they teach?
Additional table information: table: college_1

Answer: 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


Question:
Find names of all students who took some course and the course description.
Additional table information: table: college_1

Answer: 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


Question:
What are the names of all students who took a class and the corresponding course descriptions?
Additional table information: table: college_1

Answer: 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


Question:
Find names of all students who took some course and got A or C.
Additional table information: table: college_1

Answer: 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'


Question:
What are the names of all students taking a course who received an A or C?
Additional table information: table: college_1

Answer: 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'


Question:
Find the first names of all professors in the Accounting department who is teaching some course and the class room.
Additional table information: table: college_1

Answer: 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'


Question:
What are the first names of all Accounting professors who teach and what are the classrooms of the courses they teach?
Additional table information: table: college_1

Answer: 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'


Question:
Find the first names and degree of all professors who are teaching some class in Computer Info. Systems department.
Additional table information: table: college_1

Answer: 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'


Question:
What are the different first names and highest degree attained for professors teaching in the Computer Information Systems department?
Additional table information: table: college_1

Answer: 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'


Question:
What is the last name of the student who got a grade A in the class with code 10018.
Additional table information: table: college_1

Answer: 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


Question:
What is the last name of the student who received an A in the class with the code 10018?
Additional table information: table: college_1

Answer: 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


Question:
Find the first name and office of history professor who did not get a Ph.D. degree.
Additional table information: table: college_1

Answer: 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.'


Question:
What are the first names and offices of history professors who don't have Ph.D.s?
Additional table information: table: college_1

Answer: 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.'


Question:
Find the first names of professors who are teaching more than one class.
Additional table information: table: college_1

Answer: 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


Question:
What are the first names of all professors who teach more than one class?
Additional table information: table: college_1

Answer: 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


Question:
Find the first names of students who took exactly one class.
Additional table information: table: college_1

Answer: 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


Question:
What are the first names of student who only took one course?
Additional table information: table: college_1

Answer: 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


Question:
Find the name of department that offers the class whose description has the word 'Statistics'.
Additional table information: table: college_1

Answer: 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%'


Question:
What is the name of the department that offers a course that has a description including the word 'Statistics'?
Additional table information: table: college_1

Answer: 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%'


Question:
What is the first name of the student whose last name starting with the letter S and is taking ACCT-211 class?
Additional table information: table: college_1

Answer: 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%'


Question:
What is the first name of the student whose last name starts with the letter S and is taking ACCT-211?
Additional table information: table: college_1

Answer: 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%'


Question:
How many clubs are there?
Additional table information: table: sports_competition

Answer: SELECT COUNT(*) FROM club


Question:
What is the total number of clubs?
Additional table information: table: sports_competition

Answer: SELECT COUNT(*) FROM club


Question:
List the distinct region of clubs in ascending alphabetical order.
Additional table information: table: sports_competition

Answer: SELECT DISTINCT Region FROM club ORDER BY Region ASC NULLS FIRST


Question:
What are the different regions of clubs in ascending alphabetical order?
Additional table information: table: sports_competition

Answer: SELECT DISTINCT Region FROM club ORDER BY Region ASC NULLS FIRST


Question:
What is the average number of gold medals for clubs?
Additional table information: table: sports_competition

Answer: SELECT AVG(Gold) FROM club_rank


Question:
What is the average number of gold medals for a club?
Additional table information: table: sports_competition

Answer: SELECT AVG(Gold) FROM club_rank


Question:
What are the types and countries of competitions?
Additional table information: table: sports_competition

Answer: SELECT Competition_type, Country FROM competition


Question:
What are the types of every competition and in which countries are they located?
Additional table information: table: sports_competition

Answer: SELECT Competition_type, Country FROM competition


Question:
What are the distinct years in which the competitions type is not 'Tournament'?
Additional table information: table: sports_competition

Answer: SELECT DISTINCT YEAR FROM competition WHERE Competition_type <> 'Tournament'


Question:
What are the different years for all competitions that are not of type equal to tournament?
Additional table information: table: sports_competition

Answer: SELECT DISTINCT YEAR FROM competition WHERE Competition_type <> 'Tournament'


Question:
What are the maximum and minimum number of silver medals for clubs.
Additional table information: table: sports_competition

Answer: SELECT MAX(Silver), MIN(Silver) FROM club_rank


Question:
What are the maximum and minimum number of silver medals for all the clubs?
Additional table information: table: sports_competition

Answer: SELECT MAX(Silver), MIN(Silver) FROM club_rank


Question:
How many clubs have total medals less than 10?
Additional table information: table: sports_competition

Answer: SELECT COUNT(*) FROM club_rank WHERE Total < 10


Question:
What is the total number of clubs that have less than 10 medals in total?
Additional table information: table: sports_competition

Answer: SELECT COUNT(*) FROM club_rank WHERE Total < 10


Question:
List all club names in ascending order of start year.
Additional table information: table: sports_competition

Answer: SELECT name FROM club ORDER BY Start_year ASC NULLS FIRST


Question:
What are the names of all the clubs starting with the oldest?
Additional table information: table: sports_competition

Answer: SELECT name FROM club ORDER BY Start_year ASC NULLS FIRST


Question:
List all club names in descending alphabetical order.
Additional table information: table: sports_competition

Answer: SELECT name FROM club ORDER BY name DESC


Question:
What are the names of all the clubs ordered in descending alphabetical order?
Additional table information: table: sports_competition

Answer: SELECT name FROM club ORDER BY name DESC


Question:
Please show the names and the players of clubs.
Additional table information: table: sports_competition

Answer: SELECT T1.name, T2.Player_id FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID


Question:
What are the names and players of all the clubs?
Additional table information: table: sports_competition

Answer: SELECT T1.name, T2.Player_id FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID


Question:
Show the names of clubs that have players with position 'Right Wing'.
Additional table information: table: sports_competition

Answer: SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Position = 'Right Wing'


Question:
What are the names of the clubs that have players in the position of 'Right Wing'?
Additional table information: table: sports_competition

Answer: SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Position = 'Right Wing'


Question:
What is the average points of players from club with name 'AIB'.
Additional table information: table: sports_competition

Answer: SELECT AVG(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = 'AIB'


Question:
What is the average number of points for players from the 'AIB' club?
Additional table information: table: sports_competition

Answer: SELECT AVG(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = 'AIB'


Question:
List the position of players and the average number of points of players of each position.
Additional table information: table: sports_competition

Answer: SELECT POSITION, AVG(Points) FROM player GROUP BY POSITION


Question:
For each position, what is the average number of points for players in that position?
Additional table information: table: sports_competition

Answer: SELECT POSITION, AVG(Points) FROM player GROUP BY POSITION


Question:
List the position of players with average number of points scored by players of that position bigger than 20.
Additional table information: table: sports_competition

Answer: SELECT POSITION FROM player GROUP BY name HAVING AVG(Points) >= 20


Question:
What are the positions of players whose average number of points scored by that position is larger than 20?
Additional table information: table: sports_competition

Answer: SELECT POSITION FROM player GROUP BY name HAVING AVG(Points) >= 20


Question:
List the types of competition and the number of competitions of each type.
Additional table information: table: sports_competition

Answer: SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type


Question:
What are the types of competition and number of competitions for that type?
Additional table information: table: sports_competition

Answer: SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type


Question:
List the most common type of competition.
Additional table information: table: sports_competition

Answer: SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the most common competition type?
Additional table information: table: sports_competition

Answer: SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the types of competition that have at most five competitions of that type.
Additional table information: table: sports_competition

Answer: SELECT Competition_type FROM competition GROUP BY Competition_type HAVING COUNT(*) <= 5


Question:
What are the types of competition that have most 5 competitions for that type?
Additional table information: table: sports_competition

Answer: SELECT Competition_type FROM competition GROUP BY Competition_type HAVING COUNT(*) <= 5


Question:
List the names of clubs that do not have any players.
Additional table information: table: sports_competition

Answer: SELECT name FROM CLub WHERE NOT Club_ID IN (SELECT Club_ID FROM player)


Question:
What are the names of all clubs that do not have any players?
Additional table information: table: sports_competition

Answer: SELECT name FROM CLub WHERE NOT Club_ID IN (SELECT Club_ID FROM player)


Question:
What are the positions with both players having more than 20 points and less than 10 points.
Additional table information: table: sports_competition

Answer: SELECT POSITION FROM player WHERE Points > 20 INTERSECT SELECT POSITION FROM player WHERE Points < 10


Question:
What are the positions of both players that have more than 20 20 points and less than 10 points?
Additional table information: table: sports_competition

Answer: SELECT POSITION FROM player WHERE Points > 20 INTERSECT SELECT POSITION FROM player WHERE Points < 10


Question:
Show total points of all players.
Additional table information: table: sports_competition

Answer: SELECT SUM(Points) FROM player


Question:
What is the total number of points for all players?
Additional table information: table: sports_competition

Answer: SELECT SUM(Points) FROM player


Question:
how many different positions are there?
Additional table information: table: sports_competition

Answer: SELECT COUNT(DISTINCT POSITION) FROM player


Question:
How many different position for players are listed?
Additional table information: table: sports_competition

Answer: SELECT COUNT(DISTINCT POSITION) FROM player


Question:
what are the name of players who get more than the average points.
Additional table information: table: sports_competition

Answer: SELECT name FROM player WHERE points > (SELECT AVG(points) FROM player)


Question:
What are the names of all players that got more than the average number of points?
Additional table information: table: sports_competition

Answer: SELECT name FROM player WHERE points > (SELECT AVG(points) FROM player)


Question:
find the number of players whose points are lower than 30 in each position.
Additional table information: table: sports_competition

Answer: SELECT COUNT(*), POSITION FROM player WHERE points < 30 GROUP BY POSITION


Question:
What is the number of players who have points less than 30 for each position?
Additional table information: table: sports_competition

Answer: SELECT COUNT(*), POSITION FROM player WHERE points < 30 GROUP BY POSITION


Question:
which country did participated in the most number of Tournament competitions?
Additional table information: table: sports_competition

Answer: SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country ORDER BY COUNT(*) DESC LIMIT 1


Question:
what is the name of the country that participated in the most tournament competitions?
Additional table information: table: sports_competition

Answer: SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country ORDER BY COUNT(*) DESC LIMIT 1


Question:
which countries did participated in both Friendly and Tournament type competitions.
Additional table information: table: sports_competition

Answer: SELECT country FROM competition WHERE competition_type = 'Friendly' INTERSECT SELECT country FROM competition WHERE competition_type = 'Tournament'


Question:
What are the countries that participated in both friendly and tournament type competitions?
Additional table information: table: sports_competition

Answer: SELECT country FROM competition WHERE competition_type = 'Friendly' INTERSECT SELECT country FROM competition WHERE competition_type = 'Tournament'


Question:
Find the countries that have never participated in any competition with Friendly type.
Additional table information: table: sports_competition

Answer: SELECT country FROM competition EXCEPT SELECT country FROM competition WHERE competition_type = 'Friendly'


Question:
What are the countries that have never participated in any friendly-type competitions?
Additional table information: table: sports_competition

Answer: SELECT country FROM competition EXCEPT SELECT country FROM competition WHERE competition_type = 'Friendly'


Question:
How many furniture components are there in total?
Additional table information: table: manufacturer

Answer: SELECT SUM(num_of_component) FROM furniture


Question:
Return the name and id of the furniture with the highest market rate.
Additional table information: table: manufacturer

Answer: SELECT name, furniture_id FROM furniture ORDER BY market_rate DESC LIMIT 1


Question:
find the total market rate of the furnitures that have the top 2 market shares.
Additional table information: table: manufacturer

Answer: SELECT SUM(market_rate) FROM furniture ORDER BY market_rate DESC LIMIT 2


Question:
Find the component amounts and names of all furnitures that have more than 10 components.
Additional table information: table: manufacturer

Answer: SELECT Num_of_Component, name FROM furniture WHERE Num_of_Component > 10


Question:
Find the name and component amount of the least popular furniture.
Additional table information: table: manufacturer

Answer: SELECT name, Num_of_Component FROM furniture ORDER BY market_rate NULLS FIRST LIMIT 1


Question:
Find the names of furnitures whose prices are lower than the highest price.
Additional table information: table: manufacturer

Answer: 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)


Question:
Which manufacturer has the most number of shops? List its name and year of opening.
Additional table information: table: manufacturer

Answer: SELECT open_year, name FROM manufacturer ORDER BY num_of_shops DESC LIMIT 1


Question:
Find the average number of factories for the manufacturers that have more than 20 shops.
Additional table information: table: manufacturer

Answer: SELECT AVG(Num_of_Factories) FROM manufacturer WHERE num_of_shops > 20


Question:
List all manufacturer names and ids ordered by their opening year.
Additional table information: table: manufacturer

Answer: SELECT name, manufacturer_id FROM manufacturer ORDER BY open_year NULLS FIRST


Question:
Give me the name and year of opening of the manufacturers that have either less than 10 factories or more than 10 shops.
Additional table information: table: manufacturer

Answer: SELECT name, open_year FROM manufacturer WHERE num_of_shops > 10 OR Num_of_Factories < 10


Question:
what is the average number of factories and maximum number of shops for manufacturers that opened before 1990.
Additional table information: table: manufacturer

Answer: SELECT MAX(num_of_shops), AVG(Num_of_Factories) FROM manufacturer WHERE open_year < 1990


Question:
Find the id and number of shops for the company that produces the most expensive furniture.
Additional table information: table: manufacturer

Answer: 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


Question:
Find the number of funiture types produced by each manufacturer as well as the company names.
Additional table information: table: manufacturer

Answer: 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


Question:
Give me the names and prices of furnitures which some companies are manufacturing.
Additional table information: table: manufacturer

Answer: SELECT t1.name, t2.price_in_dollar FROM furniture AS t1 JOIN furniture_manufacte AS t2 ON t1.Furniture_ID = t2.Furniture_ID


Question:
Find the market shares and names of furnitures which no any company is producing in our records.
Additional table information: table: manufacturer

Answer: SELECT Market_Rate, name FROM furniture WHERE NOT Furniture_ID IN (SELECT Furniture_ID FROM furniture_manufacte)


Question:
Find the name of the company that produces both furnitures with less than 6 components and furnitures with more than 10 components.
Additional table information: table: manufacturer

Answer: 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


Question:
Display the first name and department name for each employee.
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id


Question:
What are the first name and department name of all employees?
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id


Question:
List the full name (first and last name), and salary for those employees who earn below 6000.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary FROM employees WHERE salary < 6000


Question:
What are the full names and salaries for any employees earning less than 6000?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary FROM employees WHERE salary < 6000


Question:
Display the first name, and department number for all employees whose last name is 'McEwen'.
Additional table information: table: hr_1

Answer: SELECT first_name, department_id FROM employees WHERE last_name = 'McEwen'


Question:
What are the first names and department numbers for employees with last name McEwen?
Additional table information: table: hr_1

Answer: SELECT first_name, department_id FROM employees WHERE last_name = 'McEwen'


Question:
Return all the information for all employees without any department number.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE department_id = 'null'


Question:
What are all the employees without a department number?
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE department_id = 'null'


Question:
Display all the information about the department Marketing.
Additional table information: table: hr_1

Answer: SELECT * FROM departments WHERE department_name = 'Marketing'


Question:
What is all the information about the Marketing department?
Additional table information: table: hr_1

Answer: SELECT * FROM departments WHERE department_name = 'Marketing'


Question:
when is the hire date for those employees whose first name does not containing the letter M?
Additional table information: table: hr_1

Answer: SELECT hire_date FROM employees WHERE NOT first_name LIKE '%M%'


Question:
On what dates were employees without the letter M in their first names hired?
Additional table information: table: hr_1

Answer: SELECT hire_date FROM employees WHERE NOT first_name LIKE '%M%'


Question:
display the full name (first and last), hire date, salary, and department number for those employees whose first name does not containing the letter M.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, hire_date, salary, department_id FROM employees WHERE NOT first_name LIKE '%M%'


Question:
What are the full name, hire date, salary, and department id for employees without the letter M in their first name?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, hire_date, salary, department_id FROM employees WHERE NOT first_name LIKE '%M%'


Question:
display the full name (first and last), hire date, salary, and department number for those employees whose first name does not containing the letter M and make the result set in ascending order by department number.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, hire_date, salary, department_id FROM employees WHERE NOT first_name LIKE '%M%' ORDER BY department_id NULLS FIRST


Question:
What are the full name, hire data, salary and department id for employees without the letter M in their first name, ordered by ascending department id?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, hire_date, salary, department_id FROM employees WHERE NOT first_name LIKE '%M%' ORDER BY department_id NULLS FIRST


Question:
what is the phone number of employees whose salary is in the range of 8000 and 12000?
Additional table information: table: hr_1

Answer: SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000


Question:
Return the phone numbers of employees with salaries between 8000 and 12000.
Additional table information: table: hr_1

Answer: SELECT phone_number FROM employees WHERE salary BETWEEN 8000 AND 12000


Question:
display all the information of employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE salary BETWEEN 8000 AND 12000 AND commission_pct <> 'null' OR department_id <> 40


Question:
Return all information about employees with salaries between 8000 and 12000 for which commission is not null or where their department id is not 40.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE salary BETWEEN 8000 AND 12000 AND commission_pct <> 'null' OR department_id <> 40


Question:
What are the full name (first and last name) and salary for all employees who does not have any value for commission?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary FROM employees WHERE commission_pct = 'null'


Question:
Return the full names and salaries of employees with null commissions.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary FROM employees WHERE commission_pct = 'null'


Question:
Display the first and last name, and salary for those employees whose first name is ending with the letter m.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary FROM employees WHERE first_name LIKE '%m'


Question:
Return the full names and salaries for employees with first names that end with the letter m.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary FROM employees WHERE first_name LIKE '%m'


Question:
Find job id and date of hire for those employees who was hired between November 5th, 2007 and July 5th, 2009.
Additional table information: table: hr_1

Answer: SELECT job_id, hire_date FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05'


Question:
What are the job ids and dates of hire for employees hired after November 5th, 2007 and before July 5th, 2009?
Additional table information: table: hr_1

Answer: SELECT job_id, hire_date FROM employees WHERE hire_date BETWEEN '2007-11-05' AND '2009-07-05'


Question:
What are the first and last name for those employees who works either in department 70 or 90?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name FROM employees WHERE department_id = 70 OR department_id = 90


Question:
What are the full names of employees who with in department 70 or 90?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name FROM employees WHERE department_id = 70 OR department_id = 90


Question:
Find the salary and manager number for those employees who is working under a manager.
Additional table information: table: hr_1

Answer: SELECT salary, manager_id FROM employees WHERE manager_id <> 'null'


Question:
What are the salaries and manager ids for employees who have managers?
Additional table information: table: hr_1

Answer: SELECT salary, manager_id FROM employees WHERE manager_id <> 'null'


Question:
display all the details from Employees table for those employees who was hired before 2002-06-21.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE hire_date < '2002-06-21'


Question:
What is all the information about employees hired before June 21, 2002?
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE hire_date < '2002-06-21'


Question:
display all the information for all employees who have the letters D or S in their first name and also arrange the result in descending order by salary.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' ORDER BY salary DESC


Question:
What is all the information about employees with D or S in their first name, ordered by salary descending?
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE first_name LIKE '%D%' OR first_name LIKE '%S%' ORDER BY salary DESC


Question:
display those employees who joined after 7th September, 1987.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE hire_date > '1987-09-07'


Question:
Which employees were hired after September 7th, 1987?
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE hire_date > '1987-09-07'


Question:
display the job title of jobs which minimum salary is greater than 9000.
Additional table information: table: hr_1

Answer: SELECT job_title FROM jobs WHERE min_salary > 9000


Question:
Which job titles correspond to jobs with salaries over 9000?
Additional table information: table: hr_1

Answer: SELECT job_title FROM jobs WHERE min_salary > 9000


Question:
display job Title, the difference between minimum and maximum salaries for those jobs which max salary within the range 12000 to 18000.
Additional table information: table: hr_1

Answer: SELECT job_title, max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000


Question:
What are the job titles, and range of salaries for jobs with maximum salary between 12000 and 18000?
Additional table information: table: hr_1

Answer: SELECT job_title, max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000


Question:
display the emails of the employees who have no commission percentage and salary within the range 7000 to 12000 and works in that department which number is 50.
Additional table information: table: hr_1

Answer: SELECT email FROM employees WHERE commission_pct = 'null' AND salary BETWEEN 7000 AND 12000 AND department_id = 50


Question:
What are the emails of employees with null commission, salary between 7000 and 12000, and who work in department 50?
Additional table information: table: hr_1

Answer: SELECT email FROM employees WHERE commission_pct = 'null' AND salary BETWEEN 7000 AND 12000 AND department_id = 50


Question:
display the employee ID for each employee and the date on which he ended his previous job.
Additional table information: table: hr_1

Answer: SELECT employee_id, MAX(end_date) FROM job_history GROUP BY employee_id


Question:
What are the employee ids for each employee and final dates of employment at their last job?
Additional table information: table: hr_1

Answer: SELECT employee_id, MAX(end_date) FROM job_history GROUP BY employee_id


Question:
display those departments where more than ten employees work who got a commission percentage.
Additional table information: table: hr_1

Answer: SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10


Question:
What are the department ids for which more than 10 employees had a commission?
Additional table information: table: hr_1

Answer: SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10


Question:
Find the ids of the departments where any manager is managing 4 or more employees.
Additional table information: table: hr_1

Answer: SELECT DISTINCT department_id FROM employees GROUP BY department_id, manager_id HAVING COUNT(employee_id) >= 4


Question:
What are department ids for departments with managers managing more than 3 employees?
Additional table information: table: hr_1

Answer: SELECT DISTINCT department_id FROM employees GROUP BY department_id, manager_id HAVING COUNT(employee_id) >= 4


Question:
display the average salary of employees for each department who gets a commission percentage.
Additional table information: table: hr_1

Answer: SELECT department_id, AVG(salary) FROM employees WHERE commission_pct <> 'null' GROUP BY department_id


Question:
What is the average salary of employees who have a commission percentage that is not null?
Additional table information: table: hr_1

Answer: SELECT department_id, AVG(salary) FROM employees WHERE commission_pct <> 'null' GROUP BY department_id


Question:
display the country ID and number of cities for each country.
Additional table information: table: hr_1

Answer: SELECT country_id, COUNT(*) FROM locations GROUP BY country_id


Question:
Give the country id and corresponding count of cities in each country.
Additional table information: table: hr_1

Answer: SELECT country_id, COUNT(*) FROM locations GROUP BY country_id


Question:
display job ID for those jobs that were done by two or more for more than 300 days.
Additional table information: table: hr_1

Answer: SELECT job_id FROM job_history WHERE end_date - start_date > 300 GROUP BY job_id HAVING COUNT(*) >= 2


Question:
What are the job ids for jobs done more than once for a period of more than 300 days?
Additional table information: table: hr_1

Answer: SELECT job_id FROM job_history WHERE end_date - start_date > 300 GROUP BY job_id HAVING COUNT(*) >= 2


Question:
display the ID for those employees who did two or more jobs in the past.
Additional table information: table: hr_1

Answer: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*) >= 2


Question:
What are the employee ids for employees who have held two or more jobs?
Additional table information: table: hr_1

Answer: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*) >= 2


Question:
Find employee with ID and name of the country presently where (s)he is working.
Additional table information: table: hr_1

Answer: SELECT T1.employee_id, T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id


Question:
What are all the employee ids and the names of the countries in which they work?
Additional table information: table: hr_1

Answer: SELECT T1.employee_id, T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id


Question:
display the department name and number of employees in each of the department.
Additional table information: table: hr_1

Answer: SELECT T2.department_name, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY T2.department_name


Question:
Give the name of each department and the number of employees in each.
Additional table information: table: hr_1

Answer: SELECT T2.department_name, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY T2.department_name


Question:
Can you return all detailed info of jobs which was done by any of the employees who is presently earning a salary on and above 12000?
Additional table information: table: hr_1

Answer: SELECT * FROM job_history AS T1 JOIN employees AS T2 ON T1.employee_id = T2.employee_id WHERE T2.salary >= 12000


Question:
What is all the job history info done by employees earning a salary greater than or equal to 12000?
Additional table information: table: hr_1

Answer: SELECT * FROM job_history AS T1 JOIN employees AS T2 ON T1.employee_id = T2.employee_id WHERE T2.salary >= 12000


Question:
display job title and average salary of employees.
Additional table information: table: hr_1

Answer: SELECT job_title, AVG(salary) FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id GROUP BY T2.job_title


Question:
What is the average salary for each job title?
Additional table information: table: hr_1

Answer: SELECT job_title, AVG(salary) FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id GROUP BY T2.job_title


Question:
What is the full name ( first name and last name ) for those employees who gets more salary than the employee whose id is 163?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name FROM employees WHERE salary > (SELECT salary FROM employees WHERE employee_id = 163)


Question:
Provide the full names of employees earning more than the employee with id 163.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name FROM employees WHERE salary > (SELECT salary FROM employees WHERE employee_id = 163)


Question:
return the smallest salary for every departments.
Additional table information: table: hr_1

Answer: SELECT MIN(salary), department_id FROM employees GROUP BY department_id


Question:
What is the minimum salary in each department?
Additional table information: table: hr_1

Answer: SELECT MIN(salary), department_id FROM employees GROUP BY department_id


Question:
Find the first name and last name and department id for those employees who earn such amount of salary which is the smallest salary of any of the departments.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id)


Question:
What are the full names and department ids for the lowest paid employees across all departments.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id)


Question:
Find the employee id for all employees who earn more than the average salary.
Additional table information: table: hr_1

Answer: SELECT employee_id FROM employees WHERE salary > (SELECT AVG(salary) FROM employees)


Question:
What are the employee ids for employees who make more than the average?
Additional table information: table: hr_1

Answer: SELECT employee_id FROM employees WHERE salary > (SELECT AVG(salary) FROM employees)


Question:
display the employee id and salary of all employees who report to Payam (first name).
Additional table information: table: hr_1

Answer: SELECT employee_id, salary FROM employees WHERE manager_id = (SELECT employee_id FROM employees WHERE first_name = 'Payam')


Question:
What are the employee ids of employees who report to Payam, and what are their salaries?
Additional table information: table: hr_1

Answer: SELECT employee_id, salary FROM employees WHERE manager_id = (SELECT employee_id FROM employees WHERE first_name = 'Payam')


Question:
find the name of all departments that do actually have one or more employees assigned to them.
Additional table information: table: hr_1

Answer: SELECT DISTINCT T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id


Question:
What are the names of departments that have at least one employee.
Additional table information: table: hr_1

Answer: SELECT DISTINCT T2.department_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id


Question:
get the details of employees who manage a department.
Additional table information: table: hr_1

Answer: SELECT DISTINCT * FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id WHERE T1.employee_id = T2.manager_id


Question:
What is all the information regarding employees who are managers?
Additional table information: table: hr_1

Answer: SELECT DISTINCT * FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id WHERE T1.employee_id = T2.manager_id


Question:
display all the information about the department Marketing.
Additional table information: table: hr_1

Answer: SELECT * FROM departments WHERE department_name = 'Marketing'


Question:
What is all the information about the Marketing department?
Additional table information: table: hr_1

Answer: SELECT * FROM departments WHERE department_name = 'Marketing'


Question:
display the ID for those employees who did two or more jobs in the past.
Additional table information: table: hr_1

Answer: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*) >= 2


Question:
What are the employee ids for those who had two or more jobs.
Additional table information: table: hr_1

Answer: SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*) >= 2


Question:
What are the unique ids of those departments where any manager is managing 4 or more employees.
Additional table information: table: hr_1

Answer: SELECT DISTINCT department_id FROM employees GROUP BY department_id, manager_id HAVING COUNT(employee_id) >= 4


Question:
Give the distinct department ids of departments in which a manager is in charge of 4 or more employees?
Additional table information: table: hr_1

Answer: SELECT DISTINCT department_id FROM employees GROUP BY department_id, manager_id HAVING COUNT(employee_id) >= 4


Question:
Find the job ID for those jobs which average salary is above 8000.
Additional table information: table: hr_1

Answer: SELECT job_id FROM employees GROUP BY job_id HAVING AVG(salary) > 8000


Question:
What are the job ids corresponding to jobs with average salary above 8000?
Additional table information: table: hr_1

Answer: SELECT job_id FROM employees GROUP BY job_id HAVING AVG(salary) > 8000


Question:
display the employee ID and job name for all those jobs in department 80.
Additional table information: table: hr_1

Answer: SELECT T1.employee_id, T2.job_title FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.department_id = 80


Question:
what are the employee ids and job titles for employees in department 80?
Additional table information: table: hr_1

Answer: SELECT T1.employee_id, T2.job_title FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.department_id = 80


Question:
What is the first name and job id for all employees in the Finance department?
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T1.job_id FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id WHERE T2.department_name = 'Finance'


Question:
Give the first name and job id for all employees in the Finance department.
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T1.job_id FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id WHERE T2.department_name = 'Finance'


Question:
display all the information of the employees whose salary if within the range of smallest salary and 2500.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE salary BETWEEN (SELECT MIN(salary) FROM employees) AND 2500


Question:
What is all the information regarding employees with salaries above the minimum and under 2500?
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE salary BETWEEN (SELECT MIN(salary) FROM employees) AND 2500


Question:
Find the ids of the employees who does not work in those departments where some employees works whose manager id within the range 100 and 200.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE NOT department_id IN (SELECT department_id FROM departments WHERE manager_id BETWEEN 100 AND 200)


Question:
What are the ids for employees who do not work in departments with managers that have ids between 100 and 200?
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE NOT department_id IN (SELECT department_id FROM departments WHERE manager_id BETWEEN 100 AND 200)


Question:
display the employee name ( first name and last name ) and hire date for all employees in the same department as Clara.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, hire_date FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE first_name = 'Clara')


Question:
What are the full names and hire dates for employees in the same department as someone with the first name Clara?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, hire_date FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE first_name = 'Clara')


Question:
display the employee name ( first name and last name ) and hire date for all employees in the same department as Clara excluding Clara.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, hire_date FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE first_name = 'Clara') AND first_name <> 'Clara'


Question:
What are the full names and hire dates for employees in the same department as someone with the first name Clara, not including Clara?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, hire_date FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE first_name = 'Clara') AND first_name <> 'Clara'


Question:
display the employee number and name( first name and last name ) for all employees who work in a department with any employee whose name contains a ’T’.
Additional table information: table: hr_1

Answer: SELECT employee_id, first_name, last_name FROM employees WHERE department_id IN (SELECT department_id FROM employees WHERE first_name LIKE '%T%')


Question:
What are the ids and full names for employees who work in a department that has someone with a first name that contains the letter T?
Additional table information: table: hr_1

Answer: SELECT employee_id, first_name, last_name FROM employees WHERE department_id IN (SELECT department_id FROM employees WHERE first_name LIKE '%T%')


Question:
display the employee number, name( first name and last name ), and salary for all employees who earn more than the average salary and who work in a department with any employee with a 'J' in their first name.
Additional table information: table: hr_1

Answer: SELECT employee_id, first_name, last_name, salary FROM employees WHERE salary > (SELECT AVG(salary) FROM employees) AND department_id IN (SELECT department_id FROM employees WHERE first_name LIKE '%J%')


Question:
What are the ids, full names, and salaries for employees making more than average and who work in a department with employees who have the letter J in their first name?
Additional table information: table: hr_1

Answer: SELECT employee_id, first_name, last_name, salary FROM employees WHERE salary > (SELECT AVG(salary) FROM employees) AND department_id IN (SELECT department_id FROM employees WHERE first_name LIKE '%J%')


Question:
display the employee number and job id for all employees whose salary is smaller than any salary of those employees whose job title is MK_MAN.
Additional table information: table: hr_1

Answer: SELECT employee_id, job_id FROM employees WHERE salary < (SELECT MIN(salary) FROM employees WHERE job_id = 'MK_MAN')


Question:
What are the employee ids and job ids for employees who make less than the lowest earning employee with title MK_MAN?
Additional table information: table: hr_1

Answer: SELECT employee_id, job_id FROM employees WHERE salary < (SELECT MIN(salary) FROM employees WHERE job_id = 'MK_MAN')


Question:
display the employee number, name( first name and last name ) and job title for all employees whose salary is more than any salary of those employees whose job title is PU_MAN.
Additional table information: table: hr_1

Answer: SELECT employee_id, first_name, last_name, job_id FROM employees WHERE salary > (SELECT MAX(salary) FROM employees WHERE job_id = 'PU_MAN')


Question:
What are the employee ids, full names, and job ids for employees who make more than the highest earning employee with title PU_MAN?
Additional table information: table: hr_1

Answer: SELECT employee_id, first_name, last_name, job_id FROM employees WHERE salary > (SELECT MAX(salary) FROM employees WHERE job_id = 'PU_MAN')


Question:
display the department id and the total salary for those departments which contains at least two employees.
Additional table information: table: hr_1

Answer: SELECT department_id, SUM(salary) FROM employees GROUP BY department_id HAVING COUNT(*) >= 2


Question:
What are total salaries and department id for each department that has more than 2 employees?
Additional table information: table: hr_1

Answer: SELECT department_id, SUM(salary) FROM employees GROUP BY department_id HAVING COUNT(*) >= 2


Question:
display all the information of those employees who did not have any job in the past.
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE NOT employee_id IN (SELECT employee_id FROM job_history)


Question:
What is all the information about employees who have never had a job in the past?
Additional table information: table: hr_1

Answer: SELECT * FROM employees WHERE NOT employee_id IN (SELECT employee_id FROM job_history)


Question:
display the department ID, full name (first and last name), salary for those employees who is highest salary in every department.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary, department_id, MAX(salary) FROM employees GROUP BY department_id


Question:
What are the department ids, full names, and salaries for employees who make the most in their departments?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary, department_id, MAX(salary) FROM employees GROUP BY department_id


Question:
display the first and last name, department, city, and state province for each employee.
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T1.last_name, T2.department_name, T3.city, T3.state_province FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id


Question:
What are the full names, departments, cities, and state provinces for each employee?
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T1.last_name, T2.department_name, T3.city, T3.state_province FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id


Question:
display those employees who contain a letter z to their first name and also display their last name, city.
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T1.last_name, T3.city FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id WHERE T1.first_name LIKE '%z%'


Question:
What are the full names and cities of employees who have the letter Z in their first names?
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T1.last_name, T3.city FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id WHERE T1.first_name LIKE '%z%'


Question:
display the department name, city, and state province for each department.
Additional table information: table: hr_1

Answer: SELECT T1.department_name, T2.city, T2.state_province FROM departments AS T1 JOIN locations AS T2 ON T2.location_id = T1.location_id


Question:
What are the department names, cities, and state provinces for each department?
Additional table information: table: hr_1

Answer: SELECT T1.department_name, T2.city, T2.state_province FROM departments AS T1 JOIN locations AS T2 ON T2.location_id = T1.location_id


Question:
display the full name (first and last name ) of employee with ID and name of the country presently where (s)he is working.
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T1.last_name, T1.employee_id, T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id


Question:
What the full names, ids of each employee and the name of the country they are in?
Additional table information: table: hr_1

Answer: SELECT T1.first_name, T1.last_name, T1.employee_id, T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id


Question:
display the department name and number of employees in each of the department.
Additional table information: table: hr_1

Answer: SELECT department_name, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY department_name


Question:
What are the department names and how many employees work in each of them?
Additional table information: table: hr_1

Answer: SELECT department_name, COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY department_name


Question:
display the full name (first and last name), and salary of those employees who working in any department located in London.
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id WHERE T3.city = 'London'


Question:
What are full names and salaries of employees working in the city of London?
Additional table information: table: hr_1

Answer: SELECT first_name, last_name, salary FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id WHERE T3.city = 'London'


Question:
What is the name of the song that was released in the most recent year?
Additional table information: table: music_1

Answer: SELECT song_name, releasedate FROM song ORDER BY releasedate DESC LIMIT 1


Question:
What is the name of the song that was released most recently?
Additional table information: table: music_1

Answer: SELECT song_name, releasedate FROM song ORDER BY releasedate DESC LIMIT 1


Question:
What is the id of the longest song?
Additional table information: table: music_1

Answer: SELECT f_id FROM files ORDER BY duration DESC LIMIT 1


Question:
Find the id of the song that lasts the longest.
Additional table information: table: music_1

Answer: SELECT f_id FROM files ORDER BY duration DESC LIMIT 1


Question:
Find the names of all English songs.
Additional table information: table: music_1

Answer: SELECT song_name FROM song WHERE languages = 'english'


Question:
What are the names of all songs in English?
Additional table information: table: music_1

Answer: SELECT song_name FROM song WHERE languages = 'english'


Question:
What are the id of songs whose format is mp3.
Additional table information: table: music_1

Answer: SELECT f_id FROM files WHERE formats = 'mp3'


Question:
What are the id of all the files in mp3 format?
Additional table information: table: music_1

Answer: SELECT f_id FROM files WHERE formats = 'mp3'


Question:
List the name and country of origin for all singers who have produced songs with rating above 9.
Additional table information: table: music_1

Answer: SELECT DISTINCT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.rating > 9


Question:
What are the different names and countries of origins for all artists whose song ratings are above 9?
Additional table information: table: music_1

Answer: SELECT DISTINCT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.rating > 9


Question:
List the file size and format for all songs that have resolution lower than 800.
Additional table information: table: music_1

Answer: SELECT DISTINCT T1.file_size, T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.resolution < 800


Question:
What are the file sizes and formats for all songs with a resolution lower than 800?
Additional table information: table: music_1

Answer: SELECT DISTINCT T1.file_size, T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.resolution < 800


Question:
What is the name of the artist who produced the shortest song?
Additional table information: table: music_1

Answer: SELECT T1.artist_name FROM song AS T1 JOIN files AS T2 ON T1.f_id = T2.f_id ORDER BY T2.duration NULLS FIRST LIMIT 1


Question:
What are the names of the artists who sang the shortest song?
Additional table information: table: music_1

Answer: SELECT T1.artist_name FROM song AS T1 JOIN files AS T2 ON T1.f_id = T2.f_id ORDER BY T2.duration NULLS FIRST LIMIT 1


Question:
What are the names and countries of origin for the artists who produced the top three highly rated songs.
Additional table information: table: music_1

Answer: SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name ORDER BY T2.rating DESC LIMIT 3


Question:
What are the names of the singers who sang the top 3 most highly rated songs and what countries do they hail from?
Additional table information: table: music_1

Answer: SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name ORDER BY T2.rating DESC LIMIT 3


Question:
How many songs have 4 minute duration?
Additional table information: table: music_1

Answer: SELECT COUNT(*) FROM files WHERE duration LIKE '4:%'


Question:
What is the count of the songs that last approximately 4 minutes?
Additional table information: table: music_1

Answer: SELECT COUNT(*) FROM files WHERE duration LIKE '4:%'


Question:
How many artists are from Bangladesh?
Additional table information: table: music_1

Answer: SELECT COUNT(*) FROM artist WHERE country = 'Bangladesh'


Question:
How many Bangladeshi artists are listed?
Additional table information: table: music_1

Answer: SELECT COUNT(*) FROM artist WHERE country = 'Bangladesh'


Question:
What is the average rating of songs produced by female artists?
Additional table information: table: music_1

Answer: SELECT AVG(T2.rating) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = 'Female'


Question:
How many songs, on average, are sung by a female artist?
Additional table information: table: music_1

Answer: SELECT AVG(T2.rating) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = 'Female'


Question:
What is the most popular file format?
Additional table information: table: music_1

Answer: SELECT formats FROM files GROUP BY formats ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the file format that is used by the most files.
Additional table information: table: music_1

Answer: SELECT formats FROM files GROUP BY formats ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the names of the artists who are from UK and have produced English songs.
Additional table information: table: music_1

Answer: SELECT artist_name FROM artist WHERE country = 'UK' INTERSECT SELECT artist_name FROM song WHERE languages = 'english'


Question:
What are the names of the artists that are from the UK and sang songs in English?
Additional table information: table: music_1

Answer: SELECT artist_name FROM artist WHERE country = 'UK' INTERSECT SELECT artist_name FROM song WHERE languages = 'english'


Question:
Find the id of songs that are available in mp4 format and have resolution lower than 1000.
Additional table information: table: music_1

Answer: SELECT f_id FROM files WHERE formats = 'mp4' INTERSECT SELECT f_id FROM song WHERE resolution < 1000


Question:
What is the id of the files that are available in the format of mp4 and a resolution smaller than 1000?
Additional table information: table: music_1

Answer: SELECT f_id FROM files WHERE formats = 'mp4' INTERSECT SELECT f_id FROM song WHERE resolution < 1000


Question:
What is the country of origin of the artist who is female and produced a song in Bangla?
Additional table information: table: music_1

Answer: SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = 'Female' AND T2.languages = 'bangla'


Question:
What countries are the female artists who sung in the language Bangla from?
Additional table information: table: music_1

Answer: SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = 'Female' AND T2.languages = 'bangla'


Question:
What is the average duration of songs that have mp3 format and resolution below 800?
Additional table information: table: music_1

Answer: SELECT AVG(T1.duration) FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = 'mp3' AND T2.resolution < 800


Question:
What is the average song duration for the songs that are in mp3 format and whose resolution below 800?
Additional table information: table: music_1

Answer: SELECT AVG(T1.duration) FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = 'mp3' AND T2.resolution < 800


Question:
What is the number of artists for each gender?
Additional table information: table: music_1

Answer: SELECT COUNT(*), gender FROM artist GROUP BY gender


Question:
How many artists are male and how many are female?
Additional table information: table: music_1

Answer: SELECT COUNT(*), gender FROM artist GROUP BY gender


Question:
What is the average rating of songs for each language?
Additional table information: table: music_1

Answer: SELECT AVG(rating), languages FROM song GROUP BY languages


Question:
What is the average song rating for each language?
Additional table information: table: music_1

Answer: SELECT AVG(rating), languages FROM song GROUP BY languages


Question:
Return the gender and name of artist who produced the song with the lowest resolution.
Additional table information: table: music_1

Answer: SELECT T1.gender, T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name ORDER BY T2.resolution NULLS FIRST LIMIT 1


Question:
What is the gender and name of the artist who sang the song with the smallest resolution?
Additional table information: table: music_1

Answer: SELECT T1.gender, T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name ORDER BY T2.resolution NULLS FIRST LIMIT 1


Question:
For each file format, return the number of artists who released songs in that format.
Additional table information: table: music_1

Answer: SELECT COUNT(*), formats FROM files GROUP BY formats


Question:
How many songs were released for each format?
Additional table information: table: music_1

Answer: SELECT COUNT(*), formats FROM files GROUP BY formats


Question:
Find the distinct names of all songs that have a higher resolution than some songs in English.
Additional table information: table: music_1

Answer: SELECT DISTINCT song_name FROM song WHERE resolution > (SELECT MIN(resolution) FROM song WHERE languages = 'english')


Question:
What are the different names for all songs that have a higher resolution than English songs?
Additional table information: table: music_1

Answer: SELECT DISTINCT song_name FROM song WHERE resolution > (SELECT MIN(resolution) FROM song WHERE languages = 'english')


Question:
What are the names of all songs that have a lower rating than some song of blues genre?
Additional table information: table: music_1

Answer: SELECT song_name FROM song WHERE rating < (SELECT MAX(rating) FROM song WHERE genre_is = 'blues')


Question:
What are the names of the songs that have a lower rating than at least one blues song?
Additional table information: table: music_1

Answer: SELECT song_name FROM song WHERE rating < (SELECT MAX(rating) FROM song WHERE genre_is = 'blues')


Question:
What is the name and country of origin of the artist who released a song that has 'love' in its title?
Additional table information: table: music_1

Answer: SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.song_name LIKE '%love%'


Question:
What are the names of the artists who released a song that has the word love in its title, and where are the artists from?
Additional table information: table: music_1

Answer: SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.song_name LIKE '%love%'


Question:
List the name and gender for all artists who released songs in March.
Additional table information: table: music_1

Answer: SELECT T1.artist_name, T1.gender FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.releasedate LIKE '%Mar%'


Question:
What are the names and genders of all artists who released songs in the month of March?
Additional table information: table: music_1

Answer: SELECT T1.artist_name, T1.gender FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.releasedate LIKE '%Mar%'


Question:
List the names of all genres in alphabetical oder, together with its ratings.
Additional table information: table: music_1

Answer: SELECT g_name, rating FROM genre ORDER BY g_name NULLS FIRST


Question:
What are the names of all genres in alphabetical order, combined with its ratings?
Additional table information: table: music_1

Answer: SELECT g_name, rating FROM genre ORDER BY g_name NULLS FIRST


Question:
Give me a list of the names of all songs ordered by their resolution.
Additional table information: table: music_1

Answer: SELECT song_name FROM song ORDER BY resolution NULLS FIRST


Question:
What are the names of all songs that are ordered by their resolution numbers?
Additional table information: table: music_1

Answer: SELECT song_name FROM song ORDER BY resolution NULLS FIRST


Question:
What are the ids of songs that are available in either mp4 format or have resolution above 720?
Additional table information: table: music_1

Answer: SELECT f_id FROM files WHERE formats = 'mp4' UNION SELECT f_id FROM song WHERE resolution > 720


Question:
What are the ids of all songs that are available on mp4 or have a higher resolution than 720?
Additional table information: table: music_1

Answer: SELECT f_id FROM files WHERE formats = 'mp4' UNION SELECT f_id FROM song WHERE resolution > 720


Question:
List the names of all songs that have 4 minute duration or are in English.
Additional table information: table: music_1

Answer: SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.duration LIKE '4:%' UNION SELECT song_name FROM song WHERE languages = 'english'


Question:
What are the names of all songs that are approximately 4 minutes long or are in English?
Additional table information: table: music_1

Answer: SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.duration LIKE '4:%' UNION SELECT song_name FROM song WHERE languages = 'english'


Question:
What is the language used most often in the songs?
Additional table information: table: music_1

Answer: SELECT languages FROM song GROUP BY languages ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the languages that are used most often in songs?
Additional table information: table: music_1

Answer: SELECT languages FROM song GROUP BY languages ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the language that was used most often in songs with resolution above 500?
Additional table information: table: music_1

Answer: SELECT artist_name FROM song WHERE resolution > 500 GROUP BY languages ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the name of the artist, for each language, that has the most songs with a higher resolution than 500?
Additional table information: table: music_1

Answer: SELECT artist_name FROM song WHERE resolution > 500 GROUP BY languages ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of artists who are Male and are from UK?
Additional table information: table: music_1

Answer: SELECT artist_name FROM artist WHERE country = 'UK' AND gender = 'Male'


Question:
What are the names of all male British artists?
Additional table information: table: music_1

Answer: SELECT artist_name FROM artist WHERE country = 'UK' AND gender = 'Male'


Question:
Find the names of songs whose genre is modern or language is English.
Additional table information: table: music_1

Answer: SELECT song_name FROM song WHERE genre_is = 'modern' OR languages = 'english'


Question:
What are the names of the songs that are modern or sung in English?
Additional table information: table: music_1

Answer: SELECT song_name FROM song WHERE genre_is = 'modern' OR languages = 'english'


Question:
Return the names of songs for which format is mp3 and resolution is below 1000.
Additional table information: table: music_1

Answer: SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = 'mp3' INTERSECT SELECT song_name FROM song WHERE resolution < 1000


Question:
What are the names of all songs that are in mp3 format and have a resolution lower than 1000?
Additional table information: table: music_1

Answer: SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = 'mp3' INTERSECT SELECT song_name FROM song WHERE resolution < 1000


Question:
Return the names of singers who are from UK and released an English song.
Additional table information: table: music_1

Answer: SELECT artist_name FROM artist WHERE country = 'UK' INTERSECT SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = 'english'


Question:
What are the names of all singers that are from the UK and released a song in English?
Additional table information: table: music_1

Answer: SELECT artist_name FROM artist WHERE country = 'UK' INTERSECT SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = 'english'


Question:
What are the average rating and resolution of songs that are in Bangla?
Additional table information: table: music_1

Answer: SELECT AVG(rating), AVG(resolution) FROM song WHERE languages = 'bangla'


Question:
What is the average rating and resolution of all bangla songs?
Additional table information: table: music_1

Answer: SELECT AVG(rating), AVG(resolution) FROM song WHERE languages = 'bangla'


Question:
What are the maximum and minimum resolution of songs whose duration is 3 minutes?
Additional table information: table: music_1

Answer: SELECT MAX(T2.resolution), MIN(T2.resolution) FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.duration LIKE '3:%'


Question:
What is the maximum and minimum resolution of all songs that are approximately 3 minutes long?
Additional table information: table: music_1

Answer: SELECT MAX(T2.resolution), MIN(T2.resolution) FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.duration LIKE '3:%'


Question:
What are the maximum duration and resolution of songs grouped and ordered by languages?
Additional table information: table: music_1

Answer: SELECT MAX(T1.duration), MAX(T2.resolution), T2.languages FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.languages ORDER BY T2.languages NULLS FIRST


Question:
What are the maximum duration and resolution of all songs, for each language, ordered alphabetically by language?
Additional table information: table: music_1

Answer: SELECT MAX(T1.duration), MAX(T2.resolution), T2.languages FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.languages ORDER BY T2.languages NULLS FIRST


Question:
What are the shortest duration and lowest rating of songs grouped by genre and ordered by genre?
Additional table information: table: music_1

Answer: SELECT MIN(T1.duration), MIN(T2.rating), T2.genre_is FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.genre_is ORDER BY T2.genre_is NULLS FIRST


Question:
What is the shortest and most poorly rated song for each genre, ordered alphabetically by genre?
Additional table information: table: music_1

Answer: SELECT MIN(T1.duration), MIN(T2.rating), T2.genre_is FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id GROUP BY T2.genre_is ORDER BY T2.genre_is NULLS FIRST


Question:
Find the names and number of works of all artists who have at least one English songs.
Additional table information: table: music_1

Answer: SELECT T1.artist_name, COUNT(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = 'english' GROUP BY T2.artist_name HAVING COUNT(*) >= 1


Question:
What are the names and number of works for all artists who have sung at least one song in English?
Additional table information: table: music_1

Answer: SELECT T1.artist_name, COUNT(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = 'english' GROUP BY T2.artist_name HAVING COUNT(*) >= 1


Question:
Find the name and country of origin for all artists who have release at least one song of resolution above 900.
Additional table information: table: music_1

Answer: SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.resolution > 900 GROUP BY T2.artist_name HAVING COUNT(*) >= 1


Question:
What is the name and country of origin for each artist who has released a song with a resolution higher than 900?
Additional table information: table: music_1

Answer: SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.resolution > 900 GROUP BY T2.artist_name HAVING COUNT(*) >= 1


Question:
Find the names and number of works of the three artists who have produced the most songs.
Additional table information: table: music_1

Answer: SELECT T1.artist_name, COUNT(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY COUNT(*) DESC LIMIT 3


Question:
What are the names of the three artists who have produced the most songs, and how many works did they produce?
Additional table information: table: music_1

Answer: SELECT T1.artist_name, COUNT(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY COUNT(*) DESC LIMIT 3


Question:
Find the country of origin for the artist who made the least number of songs?
Additional table information: table: music_1

Answer: SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What country is the artist who made the fewest songs from?
Additional table information: table: music_1

Answer: SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY COUNT(*) NULLS FIRST LIMIT 1


Question:
What are the names of the songs whose rating is below the rating of all songs in English?
Additional table information: table: music_1

Answer: SELECT song_name FROM song WHERE rating < (SELECT MIN(rating) FROM song WHERE languages = 'english')


Question:
What are the song names for every song whose rating is less than the minimum rating for English songs?
Additional table information: table: music_1

Answer: SELECT song_name FROM song WHERE rating < (SELECT MIN(rating) FROM song WHERE languages = 'english')


Question:
What is ids of the songs whose resolution is higher than the resolution of any songs with rating lower than 8?
Additional table information: table: music_1

Answer: SELECT f_id FROM song WHERE resolution > (SELECT MAX(resolution) FROM song WHERE rating < 8)


Question:
What is the id of every song that has a resolution higher than that of a song with a rating below 8?
Additional table information: table: music_1

Answer: SELECT f_id FROM song WHERE resolution > (SELECT MAX(resolution) FROM song WHERE rating < 8)


Question:
What is ids of the songs whose resolution is higher than the average resolution of songs in modern genre?
Additional table information: table: music_1

Answer: SELECT f_id FROM song WHERE resolution > (SELECT AVG(resolution) FROM song WHERE genre_is = 'modern')


Question:
What are the ids of all songs that have higher resolution of the average resolution in the modern genre?
Additional table information: table: music_1

Answer: SELECT f_id FROM song WHERE resolution > (SELECT AVG(resolution) FROM song WHERE genre_is = 'modern')


Question:
Find the top 3 artists who have the largest number of songs works whose language is Bangla.
Additional table information: table: music_1

Answer: SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = 'bangla' GROUP BY T2.artist_name ORDER BY COUNT(*) DESC LIMIT 3


Question:
What are the top 3 artists with the largest number of songs in the language Bangla?
Additional table information: table: music_1

Answer: SELECT T1.artist_name FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = 'bangla' GROUP BY T2.artist_name ORDER BY COUNT(*) DESC LIMIT 3


Question:
List the id, genre and artist name of English songs ordered by rating.
Additional table information: table: music_1

Answer: SELECT f_id, genre_is, artist_name FROM song WHERE languages = 'english' ORDER BY rating NULLS FIRST


Question:
What is the id, genre, and name of the artist for every English song ordered by ascending rating?
Additional table information: table: music_1

Answer: SELECT f_id, genre_is, artist_name FROM song WHERE languages = 'english' ORDER BY rating NULLS FIRST


Question:
List the duration, file size and format of songs whose genre is pop, ordered by title?
Additional table information: table: music_1

Answer: SELECT T1.duration, T1.file_size, T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.genre_is = 'pop' ORDER BY T2.song_name NULLS FIRST