Basic SELECT Statements - techie

Latest

Tuesday, February 5, 2019

Basic SELECT Statements

Elements of the SELECT statement       

 Clause
 Expression
 SELECT
 <select list>
 FROM
 <table source>
 WHERE
 <search condition>
 GROUP BY
 <group by list>
 ORDER BY
 <order by list>

Retrieving columns from a table or view

Use SELECT with column list to display columns
Use FROM to specify a source table or view
       Specify both schema and table names
Delimit names if necessary
End all statements with a semicolon

 Keyword
 EXpression
 SELECT
 <select list>
 FROM
 <table source>

SELECT  CustomerID,  StoreID
FROM   Sales.Customer ;

Using calculations in the SELECT clause

Calculations are scalar, returning one value per row
 Operator
 Description
 +
 Add or concatenate
 -
 Subtract
 *
 Multiply
 /
 Divide
 %
 Module

Using scalar expressions in the SELECT clause

SELECT  unitprice,  OrderQty,  (unitprice  *  OrderQty)
FROM     sales.salesorderdetail ;



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.