You are on page 1of 2

DRL COMMAND:data retrieving language/data query language

Select command is a drl command

Syntax:select * means to show all columns from table

Select * from emp

Select empno,ename from emp

Or

Select ename,job,deptno from emp

If we want emp details working in deptno only 20 among 10,20,30

So,filter is used………

Whenever we want to filter a record we use where clause

Syntax: select * from emp where depyno=20(it gives records which belong to deptno=20
only)

If we want to have all columns working as manager only then,

Syntax:select * from emp where job=’MANAGER’(data to be filtered is case sensitive,means in emp table
manager was in caps so here also we have to enter the same)

If we want to have empno of only king,then

Select ename from emp where ename=’KING’

Select * from emp where ename=’KING’(gives all columns of king)

This is a child table

Deptname is master table

If we want to arrange we should use order by clause(

Syntax : select * from emp order by sal(sal is a column name)

by default order will be in ascending

if we want in descending then,use syntax:select * from emp order by sal desc

if we want all records of deptno in ascending like 10,10,10,20,20,20,30,30,30 then

if we wnt to select all record from emp working as salesman in ascending order
if we want to select according to hire date

You might also like