So the question is: Create a nested query that retrieves the student id and name
ID: 3680672 • Letter: S
Question
So the question is:
Create a nested query that retrieves the student id and name of all students who have ever been enrolled in the same course section as the student who has student id = 2. Do not list student whose id is 2, and only list each name once, as shown:
I wrote this code:
25: SELECT s_id, s_last || ' ' || s_first
26: FROM student JOIN course_section USING (f_id)
27: WHERE s_id = (SELECT f_id
28: FROM course_section
29: WHERE f_id = (SELECT s_id
30: FR0M student
31 : WHERE s_id = 2)
32: AND s_id != 2;
And I get this error:
ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
*Cause:
*Action:
Error at Line: 30 Column: 40
Sorry for the formatting. Chegg formats it weird after I post it.
S_ID Student Name Miller, Sarah Black, Daniel Sanchez, Ruben 1Explanation / Answer
Hi, Please find the updated query. Its working fine now.
SELECT s_id, s_last || ' ' || s_first FROM student JOIN course_section USING (f_id) WHERE s_id = (SELECT f_id FROM course_section WHERE f_id = (SELECT s_id FROM student WHERE s_id = 2)) AND s_id != 2;
In highlighted subquery, FROM keyword contains "0" letter instead of "O" letter. It should be "FROM" not "FR0M".
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.