T-SQL – Sub-Queries A sub-query or Inner query or Nested query is a query within another SQL Server query and embedded within the WHERE clause. A sub query is used to return data that will be used in the main query as a condition to further restrict the data to be retrieved. Sub queries can […]
Author Archives: user
T-SQL – DISTINCT Clause The MS SQL Server DISTINCT keyword is used in conjunction with SELECT statement to eliminate all the duplicate records and fetching only unique records. There may be a situation when you have multiple duplicate records in a table. While fetching such records, it makes more sense to fetch only unique records […]
T-SQL – ORDER BY Clause The MS SQL Server ORDER BY clause is used to sort the data in ascending or descending order, based on one or more columns. Some database sort query results in ascending order by default. Syntax Following is the basic syntax of ORDER BY clause. SELECT column-list FROM table_name [WHERE condition] […]