Hi, Is there any difference between, NULL and ''? For example, consider this query select * from employees where username is null Code (markup): and select * from employees where username = '' Code (markup): Please explain the diff. Thanx
Null is an undefined value and '' is an empty String. Null specifies there is no data stored and '' specifies that the data is an empty string. In short they are two different things. If you don't need undefined values then you can instruct the database server to create a column as not null. This forces you to insert data since the absence of data is not accepted. Null values can be used for optional information like for example an telephonenumber column, if this is not required information then you can make this a null column.
yup it's true. '' means an empty string, so while you said select * from table where username is NULL >> it works, the program search where the username was NULL