Friday, 16 August 2013

“COMMAN SQL STATEMENTS”


In this post we will discuss Comman SQL Statement, which one  of the most important part for testing .Must read this ......
P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger
5 Tjessem Jakob Nissestien 67 Sandnes 
 
1.DELETE FROM Persons WHERE LastName='Tjessem' AND FirstName='Jakob'
 
2. SELECT DISTINCT City FROM Persons
 

Operators Allowed in the WHERE Clause
 
3. With the WHERE clause, the following operators can be used:
 
Operator Description
= Equal
<> Not equal
> Greater than
< Less 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 columns
Note: In some versions of SQL the <> operator may be written as ! =
4. SELECT * FROM Persons WHERE LastName='Svendson' AND (FirstName='Tove' OR FirstName='Ola')
5. SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC
 
 
6. INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)
 
7. UPDATE Persons SET Address='Nissestien 67', City='Sandnes' WHERE LastName='Tjessem' AND FirstName='Jakob'
 

No comments:

Post a Comment