human
Schema:
classroom (building, room_number, capacity)
department (dept_name, building, budget)
course (course_id, title, dept_name, credits)
instructor (ID, name, dept_name, salary)
section (course_id, sec_id, semester, year, building, room_number, time_slot_id)
teaches (ID, course_id, sec_id, semester, year)
student (ID, name, dept_name, tot_cred)
takes (ID, course_id, sec_id, semester, year, grade)
advisor (s_ID, i_ID)
time_slot (time_slot_id, day, start_hr, start_min, end_hr, end_min)
prereq (course_id, prereq_id)
Please answer with SQL.
assistant
Sure, I understand.
human
what is the name of the instructor who is in Statistics department and earns the lowest salary?
assistant
SELECT name FROM instructor WHERE dept_name = 'Statistics' ORDER BY salary LIMIT 1
human
What is the name and building of the departments whose budget is more than the average budget?
assistant
SELECT dept_name , building FROM department WHERE budget > (SELECT avg(budget) FROM department)
human
Find the names of all instructors in Comp. Sci. department with salary > 80000.
assistant
SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.' AND salary > 80000
human
List the information of all instructors ordered by their salary in ascending order.
assistant
SELECT * FROM instructor ORDER BY salary
human
Who is the instructor with the highest salary?
assistant
SELECT name FROM instructor ORDER BY salary DESC LIMIT 1
human
How many instructors are in the department with the highest budget, and what is their average salary?
assistant
SELECT avg ( T1.salary ) , COUNT( * ) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name = T2.dept_name ORDER BY T2.budget DESC LIMIT 1 ;