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