–isnull(column, value) – replace the null value to a specific value and datatype should match
–where column is null — fetch the records where column has null value
–where column is not null — is null vice-versa
select
isnull(e.eno,0) EmployeeNo,
isnull(e.EName,’NO-Name’) [Employee Name],
isnull(d.DName,’No-Department’) DeptName,
e.MgrId ManagerId
from tbldept d
full join tblemp e on d.dno=e.DNo;
— column alias: give an another name to column or expression in select statement
–syntax select column columnAlias, expression [column Alias] from tblname;
–COALESCE() returns the first Non NULL value
select eno,coalesce(FName,MName,LName) [Name] from tblemp;
select * from tblemp;
–UNION and UNION ALL operators in SQL Server, are used to combine the result-set of two or more SELECT
queries.
select * from tblDept
union all
select * from tblusdept;