Answers

Question and Answer:

  Home  MS SQL Server

⟩ What Is a SELECT Query Statement in MS SQL Server?

The SELECT statement is also called the query statement. It is the most frequently used SQL statement in any database application. SELECT statements allows you to retrieve data from one or more tables or views, with different selection criteria, grouping criteria and sorting orders.

A SELECTE statement has the following basic syntax:

SELECT select_list

FROM table_source

WHERE search_condition

GROUP BY group_by_expression

HAVING search_condition

ORDER BY order_by_expression

Here is an example of a SELECT statement with all clauses mentioned above:

SELECT SalesOrderID, SUM(LineTotal) AS TotalPrice

FROM SalesLT.SalesOrderDetail

WHERE ModifiedDate > '2004-05-01'

GROUP BY SalesOrderID

HAVING COUNT(*) > 30

ORDER BY TotalPrice DESC

 141 views

More Questions for you: