Monday, March 10, 2008

SQL - LIKE Keyword

This condition is used to check a particular pattern of string in the where clause conditions.

% is used to check more than one character _ is used to check only one character.

Select column name from table name where column name like ‘%en%’

Select column name from table name where column name like ‘_eseph’

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

SQL - Introduction

SQL means Structured Query Language. It is an ANSI standard computer language.
This is used to work withe the DATABASE to fetch, add or update the database contents and also to create the database structure.