Sunday, October 25, 2009

SQL

 SELECT ______ FROM__________;

Above, CAPITAL LETTERS is rule but not standard.

Spaces and extra lines are ignored.

Semi colon is must as to represent end of statement.


Multiple columns:

> select name, zip from customers;

Duplicate, Distinct & limit:

> select distinct state from customers; --> Gets only distinct item in that column name.

> select name, id from customers LIMIT 5; --> Gets only 5 results

> select id, name from customers limit 5,10; --> This starts from 6th position but gives 10 results from that number and it starts from 6th because computer starts counting from 0


***

No comments:

Post a Comment