

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 Questions & Answers
- 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?
- I want to round a number to 2 decimal places in SAPUI5. Could anyone help?
- How to round a number to n decimal places in Java
- Java Program to Round a Number to n Decimal Places
- Java Program to format to 2 decimal places in a 10-character field
- Format amount values for thousands number with two decimal places in MySQL?
- How to limit Decimal Places in Android EditText?
- How to use String Format to show decimal up to 2 places or simple integer in C#?
- MySQL query to fetch records before currentdate + 2 weeks?
- Java Program to get a character located at the String's specified index
- How to truncate a numerical vector to a specified number of decimal places in R?
- How to parse float with two decimal places in JavaScript?
- Get at least x number of rows in MySQL?
Advertisements