Friday 22 July 2011

SQL Predicates


sql - predicates

SQL Predicates are found on the tail end of clauses, functions, and SQL expression inside of existing query statements. We've actually already covered a few SQL predicates already and most on this list should be familiar to you.

SQL Predicates:

AND
OR
LIKE
BETWEEN
AS
TOP(LIMIT)

sql - top

SQL Top is used to limit the number of results returned by a query. The top command is generally followed by a number that indicates the maximum number of results to return for a given query.

SQL Code:

use mydatabase;
 
SELECT TOP 2 *
FROM orders

SQL Results:

id
customer
day_of_order
product
quantity
1
Tizag
2008-08-01 00:00:00.000
Pen
4
2
Tizag
2008-08-01 00:00:00.000
Stapler
3

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...