Friday, 25 March 2016

SQL SERVER -- What is NULL -- Part-13

SQL SERVER -- What is NULL -- Part-13


What is NULL:-
                                               NULL Value nothing but a Unknown Value.
The Value of an NULL is different from am empty OR Zero value.
No two NULL values are equal.
Comparisons between two NULL values will return unknown because the value of each NULL is different.

USE TEMPDB
GO
-- How to Create New Table
CREATE TABLE EMP
(
       EMPID INT
      ,EMPNAME VARCHAR(50)
      ,SAL MONEY
      ,DOJ DATE
      ,LOC VARCHAR(50)
      ,GENDER CHAR(6)
      ,MagrID INT
      ,DEPTNO INT
      ,RelievedDate DATE
      
)

INSERT INTO EMP(EMPID, EMPNAME, SAL, DOJ, LOC, GENDER, MagrID, DEPTNO)
VALUES(1,'Santhosh',35000,'01-12-2014','Bangalore','M',3,101)

INSERT INTO EMP
VALUES(2,'Kumari',30000,'11-05-2013','Chennai','F',3,104,'2015-01-01')

INSERT INTO EMP(EMPID, EMPNAME, SAL, DOJ, LOC, GENDER, MagrID, DEPTNO)
VALUES(3,'Kamesh',75000,'01-12-2012','Mumbai','M',NULL,105)

INSERT INTO EMP(EMPID, EMPNAME, SAL, LOC, GENDER, MagrID, DEPTNO)
VALUES(4,'Arun',44000,'Hyderabad','m',5,103)

INSERT INTO EMP(EMPID, EMPNAME, DOJ, LOC, GENDER, MagrID, DEPTNO)
VALUES(5,'Aishwarya','01-12-2014','Bangalore','f',3,103)

How to Display all the Records in a Table:- 


How to Display Only NULL Records:- 



How to Display Other Than NULL Records:- 




                   



No comments:

Post a Comment