Saturday, April 21, 2012

SQL WHERE Clause

In this Post we will see another statement, as to how we can extract records based on a column information and value.

For this SQL WHERE Clause is used.

Lets have a look at our Table:


Our table has 4 records, lets try to extract the records for status that are active, Here all the records are active, just assume that there is another record here with your name and the status is inactive. so after assuming, we have 5 records, where 4 records are active and 1 inactive.

So to extract the Active Records, things to keep in mind, Table Name: C_Korner, and the column which has Active status is U_Status.

So syntax is:

SELECT column_name(s) FROM table_name
WHERE column_name operator value

And for our purpose, the query will be:

SELECT * FROM C_Korner
WHERE U_Status="Active"

With this Query, our result will display 4 records that are active, and the inactive record or maybe any other value in that U_Status will not be displayed.

Thats all in this post. Hope this was informative, and Don't forget to check my next post.

Thank You!

0 comments:

Post a Comment