Clauses in SQL

 Clauses are conditions that help us to make queries more specific or decide what data to fetch

    ex: WHERE, HAVING, ORDER BY, LIMIT, GROUP BY


1. WHERE clauses: they filter the rows based on the specified conditions

    ex select * from employee where age>20

2. LIMIT clauses are used to restrict the number of rows returned by a query.

     ex select * from employee LIMIT 2

3 ORDER BY clauses are used to sort the result in ascending or descending order. by default in ascending order

    ex select * from employee ORDER BY salary desc

Difference between having and where clause

- Where clause is used before the aggregations

- Having clause is used after aggregations 


Comments

Popular posts from this blog

Introduction to DBMS

ACID Properties

Understanding First Normal Form (1NF) in Database Design