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

teacher (ID, name, dept_ name, salary) student (ID, name, dept_ name, tot_ cred)

ID: 3842008 • Letter: T

Question

teacher (ID, name, dept_ name, salary) student (ID, name, dept_ name, tot_ cred) teaches(ID, course id, sec id, semester, year) course(course id, title, dept_ name, credits) section (course id, sec id, semester, year, building, room_ number, time_ slot_ id) Using above schemas, provide the SQL Statements for the following questions: Find all teachers earning the highest salary. Find the IDs and names of all students who were taught by a teacher named "Mujo". Make sure there are no duplicate results. Increase the salary of each instructor in the "Computer Science" department by 15%. List all the courses with the details that have never been offered (that is, do not occur in the section relation). Student (nr, town, birth date, sex, name, surname) (Sex is stored as '0' for female and '1' for male) Course(cnr, name, Inr) Enrolled in(nr, cnr) Lecturer (Inr, name, surname) Exam (nr, cnr, nr, score) Give an expression in SQL for each of the following queries based on the given schemas above: Get the name and surname of all students who were born before 1985. Get the course name, name, surname and note of students who take courses offered by Prof. Mehmed Can.. Get the nr of students who have the same sex as and live in the same town as student nr 20. Get the print all course names which are taken by students who come from Sarajevo. Print all student names, if they are taking some courses also print courses name. Get the names of students whose first letter of their name is A, B, C.

Explanation / Answer

Note : only one full question or 4 sub-questions can be answered at a time. Please post the other question seperately

Q1

1. SELECT * FROM teacher WHERE salary = (SELECT MAX(salary) FROM teacher);

2. Insufficient information. There is no relation between student and course. If you have any assumptions, let me know.

3. UPDATE teacher SET salary = 1.5 * salary WHERE dept_name = 'Computer Science'

4. SELECT DISTINCT * FROM course AS crs
    WHERE NOT EXISTS (SELECT * FROM section AS sec WHERE crs.course_id = sec.sec_id);