Search code examples
postgresqlfillautofill

Filling All column of a table with specific value in PostgreSQL?


I have a table and I wanted to fill a column with a specific value.

Sample table: It includes temperature column which is empty and I want to fill all the rows of the relevant column with 4.56.

+------------+------------------+
|temperature |dt                |
+------------+------------------+
|            |9/15/2007 12:12:12|                  
|            |9/15/2007 12:14:16|
|            |9/15/2007 12:16:02|
|            |9/15/2007 12:18:23|
|            |9/15/2007 12:21:01|
+------------+------------------+

Result:

+------------+------------------+
|temperature |dt                |
+------------+------------------+
| 4.56       |9/15/2007 12:12:12|                  
| 4.56       |9/15/2007 12:14:16|
| 4.56       |9/15/2007 12:16:02|
| 4.56       |9/15/2007 12:18:23|
| 4.56       |9/15/2007 12:21:01|
+------------+------------------+

Solution

  • update the_table
       set temperature = 4.56;
    commit;