SQL Clauses

Characterize SQL provisions: Here, we will find out about where conditions, bunch by provisos, having statements, request by provisos

SQL Clauses

SQL provisions are the exceptional/save words, which have a particular importance in a SQL language.

Note: We ought to like to compose provisos in capital letters yet it isn’t obligatory.

1) WHERE Clause

Where statement is utilized to get a contingent record. We should actualize where proviso at whatever point condition required.

Syntax:

SELECT col1,col2 FROM tablename WHERE col1 = value;

2) GROUP BY Clause

Gathering BY conditions is utilized to bring a gathering record. We should execute GROUP BY provisos at whatever point gathering required.

Gathering BY statements is utilized to orchestrate comparable records into gatherings.

Syntax:

SELECT col1,col2 FROM tablename GROUP BY columnname;

3) HAVING Clause

HAVING statements is utilized to bring a restrictive record in the wake of collection. We should actualize HAVING provisions at whatever point condition required in the wake of collection.

HAVING provisos chips away at those columns which returned by GROUP BY statements.

Syntax:

SELECT col1,col2.....coln 
FROM tablename 
WHERE colname = value 
GROUP BY colname 
HAVING colname = value;

4) Request BY Clause

Request BY provisos is utilized to bring arranged record. We should execute ORDER BY provisos at whatever point arranging required.

Request BY provisions is utilized to sort records either in ascending(ASC) or sliding order(DESC) in light of at least one section.

Syntax:

SELECT col1,col2.....coln 
FROM tablename 
WHERE colname = value 
GROUP BY colname 
HAVING colname = value 
ORDER BY columname (asc/desc);

Leave a Comment

error: Alert: Content is protected!!