
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
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)
- Related Articles
- Divide a column to get monthly salary of employees in a MySQL Query?
- How to divide each column by a particular column in R?
- MySQL query to select rows where column value is only 0, group by another column?
- How to divide each value in an R data frame by 100?
- MySQL query to group by column and display the sum of similar values in another column
- MySQL query to replace a column value
- Query to divide the values of two columns and display the result in a new column using MySQL wildcard?
- 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
- MySQL query to make a date column NULL?
- MySQL query to display ASC order in number column?
- MySQL query to remove Null Records in a column?
- MySQL query to count rows with a specific column?
- MySQL query to split a column after specific characters?
- MySQL query to remove special characters from column values?

Advertisements