command not properly ended with multiple subqueries

Advertisements
SELECT s_fname
FROM (SELECT s_fname from student) as s_n
WHERE s_n like 'Youss%';

i get this error with multiple subqueries and cant get it right.
ORA-00933: SQL command not properly ended

>Solution :

Like this:

SELECT s_fname
FROM (SELECT s_fname from student) as s_n
WHERE s_fname like 'Youss%';

Or try it this way:

with (select s_fname from student) as s_n
select s_fname from s_n
where s_fname like 'Youss%';

That said, other than as an exercise, there’s no practical reason to use a subquery here. Better just to say this:

select s_fname 
from student 
where s_fname like 'Youss%';

Leave a ReplyCancel reply