Java Topics

Operators & Order By Clause

 

Operators(AND,OR,NOT)

AND:

Syntax:

SELECT *FROM tablename
WHERE condition1 AND condition2 AND condition3 ...;

Example:

Select * from smarks where sub1=20 AND sub2=30;

OR:

Syntax:

SELECT *FROM tablename
WHERE condition1 OR condition2 OR condition3 ...;

Example:

Select * from smarks where sub2=40 OR sub3=40;

NOT:

Syntax:

SELECT *FROM tablename
WHERE NOT condition;

Example:

Select *from smarks where not sub2=40;

Between Operator:

Syntax & Example:

Select * from smarks where sub2 BETWEEN 10 AND 30;

 

ORDER By CLAUSE:

       i.          ASC

      ii.          DESC

Example:

       i.          Select * from smarks order by sub1 ASC;

      ii.          Select * from smarks order by sub1 DESC;

No comments:

Post a Comment