Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected Issue #195

Open
yangtommmmmmmm opened this issue Oct 15, 2023 · 1 comment
Open

Expected Issue #195

yangtommmmmmmm opened this issue Oct 15, 2023 · 1 comment

Comments

@yangtommmmmmmm
Copy link

Could you help me explain why I get the following error when I enter the following SQL syntax,and how to modify it?

SQL syntax:
SELECT ID, name
FROM instructor
WHERE salary = (SELECT MAX(salary) FROM instructor)

Error: at line 3: Expected ";", "except", "fetch", "group", "having", "intersect", "limit", "offset", "order", "union", or end of input but "=" found.

@rlaiola
Copy link
Contributor

rlaiola commented Oct 16, 2023

Probably, the implementation does not cover this kind of subquery expression. However, you could use common table expressions (CTE) to get the same result.

Dataset:
https://dbis-uibk.github.io/relax/calc/gist/4f7866c17624ca9dfa85ed2482078be8/relax-silberschatz-english.txt/0

Solution (SQL):

-- common table expressions
-- https://dbis-uibk.github.io/relax/help#sql-with
WITH temp AS (SELECT max(salary) AS max_salary 
              FROM instructor)
SELECT ID, name 
FROM instructor, temp
WHERE salary = max_salary;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants