Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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|
+------------+------------------+
like image 306
A.Amidi Avatar asked Nov 27 '12 09:11

A.Amidi


1 Answers

update the_table
   set temperature = 4.56;
commit;
like image 148
a_horse_with_no_name Avatar answered Sep 19 '22 14:09

a_horse_with_no_name