What is a Clause?

A clause is a part of a SQL statement that specifies a condition or action, such as filtering data or sorting results.

Sales Process (1).png

  1. SELECT: Specifies the columns to be retrieved.
SELECT column1, column2
FROM table_name;
  1. FROM: Specifies the table(s) from which to retrieve the data.
SELECT column1
FROM table_name;
  1. WHERE: Filters rows based on a specified condition.
SELECT column1
FROM table_name
WHERE condition;
  1. GROUP BY: It is used to group rows that have the same values in specified columns.
SELECT column1, COUNT(*)
FROM table_name
GROUP BY column1;
  1. HAVING: Filters groups based on a specified condition, typically used with GROUP BY.
SELECT column1, COUNT(*)
FROM table_name
GROUP BY column1
HAVING COUNT(*) > 1;