Home

SQL Keywords: BY

 

Description

The BY keyword is used to complete another keyword in a SQL expression.

The BY keyword can be preceded by the ORDER keyword to create an ORDER BY expression. The ORDER BY expression is used to sort the records of a set in ascending order.

The formula to follow is:

SELECT What FROM WhatObject ORDER BY WhatField;

Here is an example that selects two field from a table:

USE VideoCollection1;
GO

SELECT   Title,
         Director,
         YearReleased,
         Rating
FROM     Videos
ORDER BY YearReleased;
GO
 
 

 

   
    

Home Copyright © 2009-2016, FunctionX, Inc.