How to Insert Rows with NULL Values in SQL? Last Updated : 09 Nov, 2021 Comments Improve Suggest changes Like Article Like Report In SQL, due to lack of data, we sometimes need to insert rows with NULL values in the tables. Here, the keyword NULL(without quotes) is used to represent no data. There are some key points of Null value: NULL value is different from a zero value.A NULL value is used to represent a missing value, but that it usually has one of three different interpretations:The value unknown (value exists but is not known)Value not available (exists but is purposely withheld)Attribute not applicable (undefined for this tuple)It is often not possible to determine which of the meanings is intended. Hence, SQL does not distinguish between the different meanings of NULL.Syntax: INSERT INTO TABLE_NAME values (COLUMN_VALUE,NULL,........);Step 1: Create a Database. For this use the below command to create a database named GeeksForGeeks. Query: CREATE DATABASE GeeksForGeeksOutput: Step 2: Use the GeeksForGeeks database. For this use the below command. Query: USE GeeksForGeeksOutput: Step 3: Create a table WORKER inside the database GeeksForGeeks. This table has 4 columns namely STUDENT_ID, STUDENT_NAME, STUDENT_STANDARD, ENGLISH, MATHS, and PHYSICS containing student id, student name, standard, and marks of various subjects. Query: CREATE TABLE WORKER( W_NAME VARCHAR(20), CITY VARCHAR(20), AGE INT);Output: Step 4: Display the structure of the WORKER table. Query: EXEC SP_COLUMNS 'WORKER';Output: Step 5: Insert 10 rows into the WORKER table. Query: INSERT INTO WORKER VALUES('SAM','ONTARIO',NULL); INSERT INTO WORKER VALUES('TIM',NULL,56); INSERT INTO WORKER VALUES(NULL,'CAIRO',43); INSERT INTO WORKER VALUES(NULL,'MUMBAI',NULL); INSERT INTO WORKER VALUES(NULL,NULL,NULL);Output: Step 6: Display all the rows of the WORKER table including the 0(zero) values. Query: SELECT * FROM WORKER;Output: Thus, in this way, we can insert NULL values into a table. Comment More infoAdvertise with us Next Article How to Insert Rows with NULL Values in SQL? A abhisri459 Follow Improve Article Tags : SQL SQL-Server SQL-Query Similar Reads How to insert NULL value in SQLAlchemy? In this article, we will see how to insert NULL values into a PostgreSQL database using SQLAlchemy in Python. For demonstration purposes first, let us create a sample table using SQLAlchemy as shown below Creating a table using SQLAlchmey in PostgreSQL:Import necessary functions from SQLAlchemy pack 2 min read Foreign Key with a Null Value in PostgreSQL PostgreSQL supports foreign keys to ensure referential integrity between tables. Nullable foreign keys add flexibility by allowing child table rows to either reference a parent table or have a NULL value, meaning no association. While this is useful in certain cases, managing nullable foreign keys c 6 min read How to Filter Rows Without Null in a Column in SQL? Here we will see, how to filter rows without null in a column of an MS SQL Server's database table with the help of a SQL query using IS NOT NULL operator. For the purpose of demonstration, we will be creating a demo_orders table in a database called âgeeksâ. Creating the Database: Use the below SQL 2 min read How to Use NULL Values Inside NOT IN Clause in SQL? In SQL, NULL holds a special status as it represents the absence of a value, making it fundamentally different from regular values. Unlike numbers or strings, NULL cannot be directly compared using operators like = or !=. This special status often leads to unexpected behavior in SQL queries, especia 4 min read How to Insert Multiple Rows at Once in PL/SQL? As the volume and complexity of data continue to grow in modern systems, efficient data management techniques become important. One fundamental operation in database management is the insertion of multiple rows at once. In this article, we understand the techniques and methods available in PL/SQL fo 5 min read PostgreSQL - Insert Multiple Values in Various Rows PostgreSQL, one of the most popular relational database management systems (RDBMS), is widely used for storing structured data in a tabular format, much like MySQL. In relational databases, data is stored in tables where each row represents a record and each column represents an attribute. One of th 3 min read How to Ignore 0(zero) Values in SQL Query? In SQL, many times we are required to display all the rows of a table in which the entries having 0(zero) as an entry/value are ignored. This is achieved through REPLACE command in SQL. In this article, we will discuss how to ignore 0(zero) and replace them with an empty space in SQL. For this artic 2 min read How to Insert Multiple Rows to a Table in PostgreSQL? Inserting multiple rows into a table in PostgreSQL is a common and efficient operation, especially when handling large datasets. By executing a single SQL query, multiple rows can be added simultaneously, reducing overhead and enhancing performance. This method is particularly valuable in scenarios 5 min read How to Insert Row If Not Exists in SQL Managing and manipulating data in SQL is essential, especially when it comes to avoiding duplicate entries in a database. Duplicate records can lead to data inconsistencies and errors that disrupt operations and analysis. The "INSERT IF NOT EXISTS" feature in SQL acts as a safeguard, ensuring that o 6 min read How To Reset Identity Column Values In SQL An Identity Column in SQL is an auto-incrementing column used to generate unique values for each row inserted into a table. This feature is commonly used in tables that require a unique identifier, such as primary keys. The identity column allows the database to automatically handle the generation o 5 min read Like