- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
MySQL query to divide column by 100?
Let us first create a table −
mysql> create table DemoTable ( Number float ); Query OK, 0 rows affected (0.47 sec)
Insert records in the table using insert command −
mysql> insert into DemoTable values(1000); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values(1); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable values(10); Query OK, 1 row affected (0.30 sec) mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable values(390); Query OK, 1 row affected (0.09 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output−
+--------+ | Number | +--------+ | 1000 | | 1 | | 10 | | 100 | | 390 | +--------+ 5 rows in set (0.00 sec)
Following is the query to divide column by 100−
mysql> update DemoTable set Number=Number/100; Query OK, 5 rows affected (0.09 sec) Rows matched: 5 Changed: 5 Warnings: 0
Let us display table records once again −
mysql> select * from DemoTable;
This will produce the following output −
+--------+ | Number | +--------+ | 10 | | 0.01 | | 0.1 | | 1 | | 3.9 | +--------+ 5 rows in set (0.00 sec)
- How to divide each value in an R data frame by 100?
- Divide a column to get monthly salary of employees in a MySQL Query?
- How to divide each column by a particular column in R?
- How to alter a MySQL Column from varchar(30) to varchar(100)?
- MySQL query to select rows where column value is only 0, group by another column?
- MySQL query to group by column and display the sum of similar values in another column
- MySQL query to replace a column value
- MySQL query to GROUP BY multiple columns
- MySQL query to fetch record by year
- MySQL query to order by NULL values
- MySQL query to select the nth highest value in a column by skipping values
- MySQL query to group by names and display the count in a new column
- Query to divide the values of two columns and display the result in a new column using MySQL wildcard?
- MySQL query to make a date column NULL?
- Order MySQL query by multiple ids?