Monday, 29 May 2017

DBMS WHERE clause ~ GNIITHELP

WHERE clause

Where clause is used to specify condition while retriving data from table. Where clause is used mostly with SelectUpdate and Delete query. If condititon specified by where clause is true then only the result from table is returned.

Syntax for WHERE clause

SELECT column-name1, 
 column-name2, 
 column-name3, 
 column-nameN 
from table-name WHERE [condition];

Example using WHERE clause

Consider a Student table,
s_ids_Nameageaddress
101Adam15Noida
102Alex18Delhi
103Abhi17Rohtak
104Ankit22Panipat
Now we will use a SELECT statement to display data of the table, based on a condition, which we will add to the SELECT query using WHERE clause.
SELECT s_id, 
 s_name, 
 age, 
 address 
from Student WHERE s_id=101; 
s_ids_Nameageaddress
101Adam15Noida

No comments:

Post a Comment