Clauses in SQL SERVER:-

Different clauses in sql server

  1. Where
  2. Order by
  3. Distinct
  4. Group by
  5. Having
  6. With
  7. On

where clauses in sql server  :-

  • Where clauses is used to get particular records from the table based on a condition

Syntax: Select<collist>from<Tabname> where <condition>.

Condition in Where clause query:

  • Colname operatior value:  It must be relational (or) special operatior
  • Display employeerecord whose empid=2

                        Select *from emp

Where empid=2

Order of declaration  :- [user follows this one]

Means which clause

  •                      Select
  •                      From
  •                      Where
  •                      Group by
  •                      Having
  •                      Order by

Order of execution    : – [system follows]

  •   From
  •   Where
  •   Group by
  •    Having
  •    Select

Display employee records earning more than 2000.

                  Select * from emp where    sal>2000.

Display employee records earning more than 2000 and less than 5000

                Select * from emp where sal>2000 and sal<5000