What Is a SELECT Query Statement in MS SQL Server?
Submitted by: AdministratorThe 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:
<pre>
SELECT select_list
FROM table_source
WHERE search_condition
GROUP BY group_by_expression
HAVING search_condition
ORDER BY order_by_expression
</pre>
Here is an example of a SELECT statement with all clauses mentioned above:
<pre>
SELECT SalesOrderID, SUM(LineTotal) AS TotalPrice
FROM SalesLT.SalesOrderDetail
WHERE ModifiedDate > '2004-05-01'
GROUP BY SalesOrderID
HAVING COUNT(*) > 30
ORDER BY TotalPrice DESC
</pre>
Submitted by: Administrator
A SELECTE statement has the following basic syntax:
<pre>
SELECT select_list
FROM table_source
WHERE search_condition
GROUP BY group_by_expression
HAVING search_condition
ORDER BY order_by_expression
</pre>
Here is an example of a SELECT statement with all clauses mentioned above:
<pre>
SELECT SalesOrderID, SUM(LineTotal) AS TotalPrice
FROM SalesLT.SalesOrderDetail
WHERE ModifiedDate > '2004-05-01'
GROUP BY SalesOrderID
HAVING COUNT(*) > 30
ORDER BY TotalPrice DESC
</pre>
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | How To Create a Large Table with Random Data for Index Testing in MS SQL Server? |
☺ | How To Start SQL Server Browser Service? |
☺ | How To Execute the Cursor Queries with "OPEN" Statements? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | How To Use Subqueries with the EXISTS Operators in MS SQL Server? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |