SQL Tutorial
SQL Database
SQL Table
SQL Select
SQL Order By
SQL Insert
SQL Update
SQL Delete
Difference
SQL Injection
SQL String Functions
Miscl
- SQL Formatter
- SQL group by
- SQL add/drop/update column operation
- SQL CAST Function
- SQL Comments
- SQL CONCAT Function
- CTE (Common Table Expression)SQL
- How to use distinct in SQL?
- Joining Three or More Tables in SQL
- What is Web SQL?
- How to create functions in SQL?
- How to run SQL Script?
- How to Delete Duplicate Rows in SQL?
- Nth Highest salary
- 12 Codd's Rules
- SQL EXCEPT
- Types of SQL JOIN
- Change datatype of column in SQL
- SQL Auto Increment
- SQL Like
- Commit and Rollback in SQL
- SQL Concatenate
- SQL get month from the date
- Savepoint in SQL
- SQL ORDER BY DATE
- TIME Datatype in SQL
- SQL BETWEEN
- CRUD Operations in SQL
- SQL INDEX
- Scalar Functions in SQL
- SET Operators in SQL
- Types of SQL Commands
- TCL Commands in SQL
- SQL Subquery
- SQL View
- Constraints in SQL
- Pattern Matching in SQL
- SQL Date Functions
- DDL Commands in SQL
- DML Commands in SQL
- SQL CASE
- SQL Inner Join
- SQL IN Operator
- Check Constraint in SQL
- SQL CLAUSES
- SQL LOGICAL OPERATORS
- Delete Column from Table
- Add Column in the Table
- Delete one row in SQL
- Change the Column Value
- How to Add Foreign Key in SQL
- Add a Primary Key
- Insert One or More rows
- How to Use LIKE in SQL
- Cursor in SQL
- Difference Between DROP and Truncate
- SQL Comparison Operators
- SQL COUNT WHERE
- SQL SELECT MIN
- SQL Stored Procedure
- SQL SELECT AVG
- SQL SELECT MAX
- SQL ADD COLUMN
- How to use Auto-Increment in SQL
- SQL Languages
- SQL Arithmetic Operators
- How to Use GROUP BY in SQL
- How to Use ORDER BY in SQL
- Trigger in SQL
- What is Race Condition
- SQL COUNT DISTINCT
PL/SQL Tutorial
Sql Interview Question
SQl Quiz
SQL SELECT NULL
First of all we should know that what null value is? Null values are used to represent missing unknown data.
There can be two conditions:
- Where SQL is NULL
- Where SQL is NOT NULL
If in a table, a column is optional, it is very easy to insert data in column or update an existing record without adding a value in this column. This means that field has null value.
Note: we should not compare null value with 0. They are not equivalent.
Where SQL is NULL:
How to select records with null values only? (in the marks column)
There is an example of student table:
SIR_NAME | NAME | MARKS |
---|---|---|
TYAGI | SEEMA | |
SINGH | RAMAN | 5.5 |
SHARMA | AMAR | |
JAISWAL | VICKY | 6.2 |
Let's see the query to get all the records where marks is NULL:
SELECT SIR_NAME, NAME, MARKS FROM STUDENTS
WHERE MARKS IS NULL
WHERE MARKS IS NULL
It will return the following records:
SIR_NAME | NAME | MARKS |
---|---|---|
SHARMA | AMAR | |
TYAGI | SEEMA |
Where SQL is NOT NULL:
How to select records with no null values(in marks column)? Let's see the query to get all the records where marks is NOT NULL
SELECT SIR_NAME, FIRSTNAME, MARKS FROM STUDENTS
WHERE MARKS IS NOT NULL
WHERE MARKS IS NOT NULL
SIR_NAME | NAME | MARKS |
---|---|---|
SINGH | RAMAN | 5.5 |
JAISWAL | VICKY | 6.2 |