Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Refer to Figure II For every teacher, list the names and salaries of teachers wh

ID: 659166 • Letter: R

Question

Refer to Figure II
For every teacher, list the names and salaries of teachers who earn more. The list should be ordered alphabetically by the name of the lower paid teachers.

SELECT T1.teacher_name AS lower_paid, T1.salary AS lower_salary, T2.teacher_name AS higher_paid, T2.salary AS higher_salary
FROM teachers AS T1, teachers AS T2
WHERE T1.salary < T2.salary
AND T1.teacher_num = T2.teacher_num
ORDER BY T1.teacher_name;

SELECT T1.teacher_name AS lower_paid, T1.salary AS lower_salary, T2.teacher_name AS higher_paid, T2.salary AS higher_salary
FROM teachers AS T1, teachers AS T2
WHERE T1.salary < T2.salary
AND T1.teacher_num = T2.teacher_num
AND T1.teacher_name = T2.teacher_name
AND T1.phone = T2.phone
AND t1.salary = T2.salary
ORDER BY T1.teacher_name;

SELECT T1.teacher_name AS lower_paid, T1.salary AS lower_salary, T2.teacher_name AS higher_paid, T2.salary AS higher_salary
FROM teachers AS T1, teachers AS T2
WHERE T1.salary < T2.salary
ORDER BY T1.teacher_name;

SELECT T1.teacher_name AS lower_paid, T1.salary AS lower_salary, T2.teacher_name AS higher_paid, T2.salary AS higher_salary
FROM teachers AS T1, teachers AS T2
WHERE T1.salary < T2.salary
AND T1.teacher_num = T2.teacher_num
AND T1.teacher_name = T2.teacher_name
AND T1.phone = T2.phone
AND t1.salary = T2.salary
GROUP BY T1.teacher_name
ORDER BY T1.teacher_name;

Refer to Figure II
List in descending order the total number of credits awarded for each course.

SELECT course_name, SUM(num_students*num_credits) AS total_credits
FROM courses AS C, sections AS S
WHERE S.course_num = C.course_num
GROUP BY course_name
ORDER BY SUM(num_students*num_credits) DESC;

SELECT course_name, COUNT(student_num*num_credits) AS total_credits
FROM courses AS C, enrolls AS E
WHERE E.course_num = C.course_num
GROUP BY course_name
ORDER BY COUNT(student_num*num_credits) DESC;

SELECT course_name, SUM(num_students*num_credits) AS total_credits
FROM courses AS C, sections AS S
WHERE S.course_num = C.course_num
GROUP BY course_name
ORDER BY total_credits DESC;

SELECT course_name, SUM(student_num*num_credits) AS total_credits
FROM courses AS C, enrolls AS E
WHERE E.course_num = C.course_num
GROUP BY course_name
ORDER BY SUM(student_num*num_credits) DESC;

SELECT course_name, COUNT(num_students*num_credits) AS total credits
FROM courses AS C, sections AS S
WHERE S.section_num = C.section_num
GROUP BY course_name
ORDER BY total_credits DESC;

Refer to Figure II

Write the SQL statement for the following:

Write a SQL query to find the number of female enrollments in each department. The same woman signing up for two different courses in the same department counts as two separate enrollments. The query should show the name of each department and its number of female enrollments, and it should be sorted from largest to smallest number of enrollments, largest first.

SELECT T1.teacher_name AS lower_paid, T1.salary AS lower_salary, T2.teacher_name AS higher_paid, T2.salary AS higher_salary
FROM teachers AS T1, teachers AS T2
WHERE T1.salary < T2.salary
AND T1.teacher_num = T2.teacher_num
ORDER BY T1.teacher_name;

SELECT T1.teacher_name AS lower_paid, T1.salary AS lower_salary, T2.teacher_name AS higher_paid, T2.salary AS higher_salary
FROM teachers AS T1, teachers AS T2
WHERE T1.salary < T2.salary
AND T1.teacher_num = T2.teacher_num
AND T1.teacher_name = T2.teacher_name
AND T1.phone = T2.phone
AND t1.salary = T2.salary
ORDER BY T1.teacher_name;

SELECT T1.teacher_name AS lower_paid, T1.salary AS lower_salary, T2.teacher_name AS higher_paid, T2.salary AS higher_salary
FROM teachers AS T1, teachers AS T2
WHERE T1.salary < T2.salary
ORDER BY T1.teacher_name;

SELECT T1.teacher_name AS lower_paid, T1.salary AS lower_salary, T2.teacher_name AS higher_paid, T2.salary AS higher_salary
FROM teachers AS T1, teachers AS T2
WHERE T1.salary < T2.salary
AND T1.teacher_num = T2.teacher_num
AND T1.teacher_name = T2.teacher_name
AND T1.phone = T2.phone
AND t1.salary = T2.salary
GROUP BY T1.teacher_name
ORDER BY T1.teacher_name;

Explanation / Answer

Refer to Figure II For every teacher, list the names and salaries of teachers wh

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote