Reputation: 1
We are learning subqueries in Oracle SQL. I'm receiving an error "SQL command not properly ended"
with an example from my textbook that should work.
I have attempted re-spacing the subquery, but keeping the exact code, this should work
SELECT last_name, salary
FROM employees
WHERE salary > 11000
(SELECT salary
FROM employees
WHERE last_name='Abel');
ERROR at line 4: ORA-00933: SQL command not properly ended
Upvotes: 0
Views: 49
Reputation: 1269503
Is this what you want?
SELECT last_name, salary
FROM employees
WHERE salary > 11000 AND
last_name = 'Abel';
This would return employees named "Abel" whose salary exceeds 11,000.
Upvotes: 0
Reputation: 50017
There needs to be something between the 11000
and the following subselect. As an example, it might be that the following was intended:
SELECT last_name, salary
FROM employees
WHERE salary > 11000 AND
salary IN (SELECT salary
FROM employees
WHERE last_name='Abel');
Upvotes: 2