Category: Server Clauses
-
SQL Server GROUPING SETS
GROUPING SET is an extension of the GROUP BY clause. The GROUP BY statement is GROUPING SET is an extension of the GROUP BY clause. The GROUP BY statement is used to summarize the data in conjunction with aggregate functions such as SUM, AVG, COUNT, etc. It groups the result set based on the single or multiple…
-
SQL Server SELECT
The SELECT statement in SQL Server is used to display all or specific records from the table. This statement allows us to fetch the records based on our needs or retrieve all records of the table. Need of SELECT statement The database can contain one or more tables, and each table stores our data in…
-
SQL Server HAVING
The HAVING clause in SQL Server is used to specify the search condition for a group or an aggregate. It can only work with the SELECT statement and is usually used with the GROUP BY clause. It enables us to filter which group results appear in the results. We used this clause instead of the WHERE clause because it places a…
-
SQL Server ORDER BY
An ORDER BY clause is used to arrange the table’s data in ascending or descending order based on the given column or list of columns. It is usually used with the SELECT statement as it returns the records without sorting in specific orders. It means SQL Server produces the output in an unspecified order. However, using the…
-
SQL Server WHERE Clause
The WHERE clause in SQL Server is used to filter records from the table. It is an optional clause that is used to limit the number of rows returned by the query. We can also say that this clause specifies a condition to return only those records that fulfill the defined conditions. The WHERE clause can also…
-
SQL Server GROUP BY Clause
SQL Server GROUP BY clause is used to collect data across multiple records and group the results by one or more columns. It is used with SELECT statement. Syntax: Parameter explanation expression1, expression2, … expression_n: These expressions are not encapsulated within an aggregate function and must be included in the GROUP BY clause. aggregate_function: It can be…
-
SQL Server DISTINCT Clause
In SQL Server, DISTINCT clause is used to remove duplicates from the table. The DISTICT clause is only used with SELECT statement. Syntax: Parameter explanation expressions: It specifies the columns or calculations that you want to retrieve. database_name & table_name: It specifies the name of the database and name of the table on which you want to…