w3resource

PostgreSQL Insert Record: Insert NULL values into a column of a table


4. Write a SQL statement to insert NULL values into region_id column for a row of countries table.

Sample Solution:

Code:

INSERT INTO countries (country_id,country_name,region_id) 
VALUES('C3','UK',NULL);

Here is the command to see the list of inserting rows :

postgres=# SELECT * FROM countries;
 country_id | country_name | region_id
------------+--------------+-----------
 C1         | India        |      1002
 C2         | USA          |
 C3         | UK           |
(3 rows)

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming