There is a database on instructors, departments, courses, and timetables, so the question is stated accordingly. You must create a query that gives you a list of all the professors' names and the courses they teach. Each row must start with the professor's name and end with the name of the class the professor instructs. The rows must not contain any duplicates.
The table name and field names in the schema I have are:
PROFESSOR: ID, NAME, DEPARTMENT_ID, SALARY
DEPARTMENT: ID, NAME
COURSE: ID, NAME, DEPARTMENT_ID, CREDITS
SCHEDULE: PROFESSOR_ID, COURSE_ID, SEMESTER, YEAR
The code I have right now:
SELECT DISTINCT p.Name AND c.NAME
FROM Prodessor p, Course c, Schedule S
WHERE
p.DEPARTMENT_ID = c.DEPARTMENT_ID
AND
p.ID = s.PROFESSOR_ID
AND
c.ID = c.COURSE_ID
The output is a list of all the professors, but there is just one course; there are no other courses. What exactly is wrong here? Additionally, it said that PROFESSOR.ID is not related to COURSE. p.ID = s because of PROFESSOR ID. valid PROFESSOR ID.
Can someone please help me with this?