The below are some of the key points about nulls, and how to compare them. Just to make sure that you should know about what is NULL value. Interpretation is not exactly missing value. There could be many reasons why no value is present, e.g., value inappropriate. How to compare NULL to values In the below example the where condition just checks for TRUE condition. If not matches you will get UNKNOWN. Example: Table Name is: Sells bar beer price ======================= Joe's bar Bud NULL SELECT bar FROM Sells WHERE price < 2.00 OR price >= 2.00; ------------ ------------- UNKNOWN Conclusion Joe's Bar is not produced, even though the WHERE condition is correctly given. The reason is the price value is NULL. So, we should not compare NULL to values.
61. List of emps of emp1 who are not found in emp2. 62. Find the highest sal of EMP table. A) select max(sal) from emp; 63. Find details of highest paid employee. A) select * from emp where sal in (select max(sal) from emp); 64. Find the highest paid employee of sales department. A) select * from emp where sal in (select max(sal) from emp where deptno in (select d.deptno from dept d where d.dname = 'SALES')); 65. List the most recently hired emp of grade3 belongs to location CHICAGO. A) select * from emp e where e.deptno in ( select d.deptno from dept d where d.loc = 'CHICAGO') and e.hiredate in (select max(hiredate) from emp where empno in (select empno from emp e,salgrade s where e.sal between s.losal and s.hisal and s.grade = 3)) ; (or) select * from emp e,dept d where d.loc='chicago' and hiredate in(select max(hiredate) from emp e,salgrade s where sal between losal and hisal and grade=3); 66. List the employees who are senior to mos...
Comments
Post a Comment