- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get number located at 2 places before decimal point MySQL?
In order to get number located at 2 places before decimal point, you can use the concept of div.
Let us create a table −
mysql> create table demo1 −> ( −> value float −> ); Query OK, 0 rows affected (2.20 sec)
Insert some records into the table with the help of insert command −
mysql> insert into demo1 values(456.54); Query OK, 1 row affected (0.16 sec) mysql> insert into demo1 values(50.64); Query OK, 1 row affected (0.17 sec) mysql> insert into demo1 values(1000.78); Query OK, 1 row affected (0.13 sec)
Display records from the table using select statement −
mysql> select *from demo1;
This will produce the following output −
+---------+ | value | +---------+ | 456.54 | | 50.64 | | 1000.78 | +---------+ 3 rows in set (0.02 sec)
Following is the query to get number located at 2 places before decimal point.
mysql> select value div 10%10 from demo1;
This will produce the following output −
+-----------------+ | value div 10%10 | +-----------------+ | 5 | | 5 | | 0 | +-----------------+ 3 rows in set (0.03 sec)
- Related Articles
- How to format number to 2 decimal places in MySQL?
- Select rows having more than 2 decimal places in MySQL?
- Display 3 decimal places in MySQL?
- How to round a number to n decimal places in Java
- Format amount values for thousands number with two decimal places in MySQL?
- I want to round a number to 2 decimal places in SAPUI5. Could anyone help?
- The decimal expansion of the rational number will $frac{14587}{1250}$ terminate after:(A) one decimal place(B) two decimal places(C) three decimal places(D) four decimal places
- Swift Program to Round a Number to n Decimal Places
- Java Program to Round a Number to n Decimal Places
- Kotlin Program to Round a Number to n Decimal Places
- C++ Program to Round a Number to n Decimal Places
- How to remove decimal point?
- How to limit Decimal Places in Android EditText?
- How to truncate a numerical vector to a specified number of decimal places in R?
- Java Program to format to 2 decimal places in a 10-character field

Advertisements