Reputation: 1
Using the database provided, Write and Execute SELECT statements to get the following information:
SIMPLE JOINS
Sections Table
What I tried:
select sum(c.credithours)
from courses c
join sections s on c.courseid = s.courseid
join instructors i on s.instructor = i.ID
and s.instructor = 6;
ERROR:
Syntax error in FROM clause
What I tried:
select CRN, CourseName, description, credithours, timedays, roomno
from courses c
join sections s on c.courseid = s.courseid
join instructors i on s.instructor = i.ID
and roomno = "F1147";
ERROR:
Syntax error in FROM clause
StudentSchedule Table
What I tried:
select firstname, lastname, ID, CRN
from studentschedule ss
join students s on ss.student_id = s.id
and CRN = 30101;
ERROR:
Syntax error in FROM clause
What I tried:
select firstname, lastname, ID, CRN
from studentschedule ss
join students s on ss.student_id = s.id
and CRN = 30115;
ERROR:
Syntax error in FROM clause
What I tried:
select s.*
from studentschedule ss
join sections s on ss.CRN = s.CRN
and studentid = 6;
ERROR:
Syntax error in FROM clause
What I tried:
select firstname, lastname, ID, CRN, coursename
from studentschedule ss
join students s on ss.student_id = s.id
join sections sec on ss.CRN = sec.CRN
join courses c on sec.courseid = c.courseid
and CRN = 30115;
ERROR:
Syntax error in FROM clause
Upvotes: -2
Views: 2068
Reputation: 267
Access does not have JOIN on it's own.
You must use INNER JOIN, LEFT JOIN or RIGHT JOIN - or you will get that error.
for example: the solution to question 1 would be:
SELECT Sum([CreditHours]) AS totalHours
FROM Courses INNER JOIN Sections ON Courses.CourseID = Sections.CourseID
WHERE (((Sections.Instructor)=6));
note that you don't need the instructor table at all for this one, unless they ask for name or other details about the instructor.
also note: I wouldn't worry about optimizing using short table names on such a simple query.
Upvotes: -2