0

I'm trying to translate the query below from SQL Server to Oracle SQL. I'm unsure about the IFF condition for the oracle.

SELECT IIF(Grade<8, NULL,Name) As Name ,Grade,Marks 
FROM Grade,Students 
WHERE Marks>=Min_Mark and Marks<=Max_Mark 
ORDER BY Grade DESC, Name ASC;
1
  • 2
    You should stop using those ancient, outdated and fragile implicit joins in the where clause and switch to an explicit JOIN operator Commented Sep 26, 2018 at 8:49

1 Answer 1

2

You can try like below

SELECT case when Grade<8 then  NULL else Name end As Name ,Grade,Marks 
FROM Grade,Students 
WHERE Marks>=Min_Mark and Marks<=Max_Mark 
ORDER BY Grade DESC, Name ASC;

but i prefer explicit join like below

SELECT case when Grade<8 then  NULL else Name end As Name ,Grade,Marks 
    FROM Grade join Students 
    on  Grade.Marks>=Students.Min_Mark and
       Grade.Marks<=Students.Max_Mark 
    ORDER BY Grade DESC, Name ASC;
Sign up to request clarification or add additional context in comments.

2 Comments

Almost everyone agrees on the second query being best practice
Thanks for answering. Very beneficial indeed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.