w3resource logo


>Sql inserting NULL values

SQL inserting NULL values

Secondary Nav

Description

The SQL INSERT statement can also be used to insert NULL value for a column.

Example

Sample table : agents

To add values'A001','Jodi','London','.12','NULL' for a single row into the table 'agents' then, the following SQL statement can be used :

INSERT INTO agents
VALUES ("A001","Jodi","London",.12,NULL);

SQL insert values in specific columns

The SQL INSERT INTO statement can also be used to insert one or more specific columns for a row. It is required to mention the column(s) name in the SQL query.

Example

Sample table : agents

To add values'A001','Jodi', and ', 12' against the columns 'agent_code', 'agent_name' and 'commission' into the table 'agents', the following SQL statement can be used :

INSERT INTO agents
(agent_code,agent_name,commission)
VALUES ("A001","Jodi",.12)

See our Model Database

Here is a new document which is a collection of questions with short and simple answers, useful for learning SQL as well as for interviews.



Is this content useful for you?

 


You might be using Adblocker. Since w3resource does not charge anything from users, all of our expenses (e.g. Hosting, Content Creation, Development etc.) are met by advertisement. Please whitelist w3resource.