Monday, March 10, 2008

SQL - Select Query

This is used to get or retrive the data from a table.

Eg:

1) Select column name form table name

2) Select column name1, column name2 from table name

3) Select * from table name

When using distinct keyword it will remove the duplicate.

Eg:Select DISTINCT column name from table name

We can use WHERE clause to select the rows for a particular conditions as show below.

Eg: Select column name from table name where column name operator value.

The below table give all the values that can be placed instead of the operator

= Equal

<> Not equal

> Greater than

<>

>= Greater than or equal

<= Less than or equal

BETWEEN Between an inclusive range

LIKE Search for a pattern

IN If you know the exact value you want to return for at least one of the value then IN keyword should be used

No comments: