over 4 years ago
Null values denotes missing data in a table or a database. If a column does not have any NOT NULL constraint then for that column there can be NULL values. By default a column can have NULL values.
We cannot use comparison operators like =, >, < with null values. We can use IS NULL and IS NOT NULL operator to check whether there is a null value or not.
Creating a table with no null values in it:
CREATE TABLE Employees(
EMPID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
CITY CHAR (25) NOT NULL
In the above query NOT NULL keyword denotes that we have to provide some value for that column . We cannot left it blank, we must have to provide an explicit or a default value.
IS NULL Operator Example:
SELECT Name, City FROM Employees WHERE City IS NULL;
The above query will return those Employee names and cities whose City has NULL values.
IS NOT NULL Operator Example:
SELECT Name, City FROM Employees WHERE City IS NOT NULL;
The above query will return those Employee names and cities where City column has no null values in it .
DELETE FROM Employees WHERE City IS NULL;
The above query will delete those employee records whose city column contain NULL value.
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Terms of Service
| © copyright 2020 FindNerd.com. All rights reserved.
Sign up using