Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do divide column values in SQL update?

Tags:

sql

What is the correct syntax to do a SQL Update on a column and divide its values by 1 000 000?

like image 363
Adam Strudwick Avatar asked Jun 15 '11 15:06

Adam Strudwick


People also ask

How do I update multiple columns in SQL?

We can update multiple columns by specifying multiple columns after the SET command in the UPDATE statement. The UPDATE statement is always followed by the SET command, it specifies the column where the update is required. UPDATE table_name SET column_name1= value1, column_name2= value2 WHERE condition;

How to update all records in a table in SQL?

SET column1 = value1, column2 = value2, ... Note: Be careful when updating records in a table! Notice the WHERE clause in the UPDATE statement. The WHERE clause specifies which record (s) that should be updated. If you omit the WHERE clause, all records in the table will be updated!

What is an example of Division in SQL?

The simplest example of the division operator is: You can execute this query, and it will output the result – in this case, 5. However, it is more likely that you will be working with integers that reside in columns as part of your database tables. Let’s look at such an example.

What is the syntax for updating a table in SQL?

UPDATE Syntax. SET column1 = value1, column2 = value2, ... Note: Be careful when updating records in a table! Notice the WHERE clause in the UPDATE statement. The WHERE clause specifies which record (s) that should be updated. If you omit the WHERE clause, all records in the table will be updated!


1 Answers

UPDATE table SET column = column / 1000000
like image 118
Steve Prentice Avatar answered Oct 11 '22 23:10

Steve Prentice