Saturday, 27 August 2016

Conditional Operator






Good job! Now, apart from the equality sign (=), there are also some other conditional operators which you can use. Look at the next example.

SELECT * FROM user WHERE age < 20;

Instead of the equality sign (=), we put the less than sign (<). Now our instruction selects only those users who are below 20. We can apply quite a few operators in the same way:

< (less than),
> (greater than),
<= (less than or equal),
>= (greater than or equal).
Easy, right? Why don't we practice it a bit?


Syntax

SELECT * FROM table_name WHERE column_name < value;

Execute below code -

SELECT * FROM car WHERE price>10000;


VIN
BRAND
MODEL
PRICE
PRODUCTION_YEAR
WPOZZZ79ZTS372128
Ford
Fusion
12500.00
2008
JF1BR93D7BG498281
Toyota
Avensis
11300.00
1999
1M8GDM9AXKP042788
Volkswagen
Golf
13000.00
2010

No comments:

Post a Comment