HomeОбразованиеRelated VideosMore From: Imtiaz Ahmad

Lesson 7 - SQL AND and OR Operators (Oracle SQL Certification)

23 ratings | 2746 views
Take the Complete Course at: www.jobreadyprogrammer.com In this lesson, you'll learn how to combine WHERE, AND & OR with Operators
Html code for embedding videos on your blog
Text Comments (6)
Gen Valencia (3 months ago)
Is it correct to think about the operators this way? : MANAGER AND SALESMAN = returns when both are true NOT MANAGER AND NOT SALESMAN = filters out when either is true MANAGER OR SALESMAN = returns when either is true NOT MANAGER OR NOT SALESMAN = filters out when both are true I ran the code below thinking that 'MANAGER' titles would be returned in my results since 'clerl' doesn't exist, but 'MANAGER' titles were filtered out of my result: SELECT * FROM EMP WHERE JOB != 'MANAGER' AND JOB != 'clerl' AND SAL >= 2000
And yes: boolean expressions: (&& is AND, || is OR) True&&True=True , True&&False=False, True||True=True, True||False=True.
It is good practice to write the clauses (INSERT, FROM etc) with capital letters and the rest with small letters, to be easier to read.
Haudz (4 months ago)
How is it that when you query for a CLERK OR SALESMAN using the AND makes it compulsory but not compulsory for the !=
By the way, I forgot. There are some rules (in Java I used them) of the boolean expressions: (&& is AND, || is OR) True&&True=True , True&&False=False, True||True=True, True||False=True. Search this and you''ll understand.
You can't find AND CLERK AND SALESMAN on the same row. Each row contains only one of those values. So you are excluding everthing. But the != is different. You ask in the querry to display anything else that is not != 'that_value'. In Java, for example, you make the same use of this operator, turning to value to its opposite.

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.