WHERE clauses and OPERATORS

 WHERE CLAUSE

CLAUSE - conditions using which we can extract particular data

SYNTAX:

SELECT col1,col2 FROM table_name WHERE conditions;

SELECT name,age FROM users WHERE age>20;

here OPERATORS are used

ARITHMETIC: +, - , * , / , %

select  name,age from users3 WHERE followers+1=101;



COMPARISON : < , > , = , <=, >=, != 

select  name,age from users3 WHERE age>=20;



LOGICAL : 

AND,OR,BETWEEN,IN, NOT, ALL, LIKE, ANY

select  name,age,followers from users3 WHERE  followers <100 AND age>20;


OR

select  name,age,followers from users3 WHERE  followers <100 OR age>20;




BETWEEN

select name,age from users3 WHERE age BETWEEN 20 AND 23




IN

select name,age from users3 WHERE age IN (21,14);


NOT

 select name,age from users3 WHERE age NOT IN (21,14);




BITWISE : & , | 

select  name,age from users3 WHERE followers | age <100;




Comments

Popular posts from this blog

DATABASE RELATIONSHIPS

ROUTING (GET /) home route

Query Strings