Tuesday, 9 October 2012

Lesson-10 : SELECT with WHERE clause


SQL Queries - SELECT with WHERE clause

Syntax :

SELECT * or column list FROM <tablename> WHERE condition ;

Examples :

1)      To list out employee details for those who are getting salary more than 10000

         SQL> select * from emp where salary > 10000;

2)      To list out employee details whose age is less than 30

         SQL> select * from emp where age < 30;

3)      To list out employees whose name begins with ‘A’

         SQL> select * from emp where employee_name LIKE ‘A%’

4)      To list out employees whose name ends with ‘R’

         SQL> select * from emp where employee_name LIKE ‘%R’

5)      To list out employees whose age between 25 and 35

         SQL> select * from emp where age BETWEEN 25 AND 35;

6)      To list out employees who are working in dept number 10,20,30 and 40

         SQL> select * from emp where deptno IN (10,20,30,40);

 

No comments:

Post a Comment