DATABASE & SQL/PLSQL

IS NULL and IS NOT NULL keywords & ORDER BY Clause
Previous Home Next

Using IS NULL & IS NOT NULL

In SQL server, NULL is a unknown value means the data is not available. The NULL can be retrieve from the table using IS NULL keyword in the WHERE clause.

Note: NO two NULL values are equal. You can not compare one NULL value to other.

SELECT column_list
FROM table_name
WHERE column_name unknown_value_operator

Where unknown_value_operator is either the keyword IS NULL or IS NOT NULL.

Example:

SELECT *
FROM publishers
WHERE state IS NULL

Returns the all attributes of publisher table where state attribute contain NULL

SELECT *
FROM publishers
WHERE state IS NOT NULL

Returns the all attributes of publisher table where state attribute does not contain NULL

 

Using ORDER BY Clause

It retrieve and display the data in specific order. ASC is the default sort order.

SELECT column_list
FROM table_name
ORDER BY column_name ASC/DESC

Example:

SELECT column_list
FROM table_name
ORDER BY column_name ASC/DESC

Return all attributes of publishers able in order to descending alphabetically order with respect to pub_name attribute

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: