Data Retrieval/Query Language(DRL/DQL)


Data Retrieval Language:
Data Retrieval Language(DRL)  or  Data Query Language(DQL) is the ability to search for and locate ingormation that has been stored. Data Retrival is a sub language of SQL which is used to query or retrieve the data from the existing tables with in the database. This language contains One command.
                i) SELECT
i) SELECT:
This command is used to retrieve the data from the existing table. Using this command we can retrieve all records and also we can retrieve some specific records in the table(Using where clause).
Syntax:
select [<column name>,....] [*] from <table name>
            where [Condition];
Note: Here * represents all columns.
EX:
SQL>select * From emp;
SQL>select empno,ename,job from emp;
SQL>select unique job from emp;
SQL>select distinct job from emp
            where deptno=30;

WHERE Clause:

  • This clause is used to check the condition, based on the condition.
  • We can retrieve some specific records.
  • We can delete some specific records. 
  • We can modify some specific records.
  • In SQL data available in the table is case sensitive.
EX:
SQL>select empno,ename,job,deptno from emp
            where job='SALESMAN';
SQL>select * from emp
            where job='SALESMAN' and
                        deptno=10;
SQL>select * from emp
            where sal>3000;
SQL>select * from emp
            where sal>1500 and sal<5000;
SQL>select empno,ename from emp
            where deptno in(10,20);

No comments:

Post a Comment

Dear Visitor your comment make us happy, so don't forget to leave a Comment.