- This clause is used to provide comparison of data, which restricts the rows from a table.
- A WHERE clause contains a condition that must be met and should directly follow the from clause.
- Comparison to date type data is not case sensitive.
- Character values are case sensate and Date values are format Sensitive (DD-MON-YY).
- The WHERE clause can compares..Ø Values in columnsØ Literal ValuesØ Arithmetic ExpressionsØ FunctionExamples :-Display all those employees, who are working as CLERK.Ans : Select * from emp where job = ‘CLERK’;Display all those employees, who are working in deptno 20.Ans : Select * from emp where deptno=20;Display all those employees, who have been hired on 3rd-dec-81.Ans : Select * from emp where hiredate=’3rd-dec-81’;Display empno,ename,job,sal,deptno for all those employees who are working in deptno 20 and as CLERK.Ans : Select empno, ename, job, sal, deptno from empWhere deptno=20 AND job=’CLERK’;Display ename,job,salary,deptno for all those employees who are not working as MANAGER.Ans : Select ename, job, sal, deptno from empWhere job !=’MANAGER’;Display ename, job, salary, deptno for all those employees whose salary is >=2000.Ans : Select ename, job, sal, deptno from empWhere sal>=2000;Display ename, job, salary for all those employees whose salary is >=1000 and <= 3000.Ans : Select ename, job, sal from empWhere sal>=1000 AND sal<=3000;(OR) sal BETWEEN 1000 AND 3000;Display ename, job, salary, deptno, hiredate fro all those employees who have been hired between 01-jan-81 and 31-dec-81 and they are working as clerk, salesman and salary between 1000 and 3000;Ans : Select ename, job, sal, deptno, hiredateFrom empWhere hiredate BETWEEN ’01-JAN-81’ AND ’31-DEC-81’ANDJob IN (‘CLERK’ , ‘SALESMAN’)ANDSal BETWEEN 1000 AND 3000;Display ename, job for all those employees who are not working as clerk, analyst.Ans : select ename, job from empWhere job NOT IN (‘CLERK’ , ‘ANALYST’);
An Object is a reusable application component that developers need to be aware of, rather than how it works. Object are basic entities in a system. They could represent a person, place, bank account, or any item that is handled by program. Every object consists of an attribute and one or more methods. An attribute could be any property of the object. Class: It is a collection of attributes and functions (method) to plan the object. Object Table : · Object table are created by using the user defined data types. · In an object table each row or record is treated as an object. · Each row in an object table has an object Identified (OID), which is unique through out the database. · The rows or objects of an object table can be referenced by other objects with in the database. · ...
Comments
Post a Comment