Important SQL functions



EXIST

https://www.youtube.com/watch?v=HM6Jc5YGubQ

here outer query shows the result only of inner query returns atleast one row/tuple,

in above example join was not required as we wanted result set only from one table, if we want our result to have column from both the table, then we  require joins.


Question :

PROFESSION and STUDENT table

provide name of al the profession, who is advisor to atleast one female student


select P.Name from profession as P
   EXIST ( select rollnumber from student as S
                   where P.id = s.advisorId
                    and s.sex ='F')



*SET COMPARASION OPERATION LIKE*

           IN(Item1,....)
           ANY(Item1,...)
           ALL(Item1,....)







Comments

Popular posts from this blog

Oracle User vs Oracle Schemas

Having and Where Clause