
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Get Only Floating Point Numbers from a List of Values in MySQL
Let us first create a table −
mysql> create table DemoTable628 (Value DECIMAL(10,2)); Query OK, 0 rows affected (0.52 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable628 values(10.97); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable628 values(20.04); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable628 values(12.00); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable628 values(89.56); Query OK, 1 row affected (0.20 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable628;
This will produce the following output −
+-------+ | Value | +-------+ | 10.97 | | 20.04 | | 12.00 | | 89.56 | +-------+ 4 rows in set (0.00 sec)
Following is the query to get floating point numbers from a list −
mysql> select *from DemoTable628 where Value!=FLOOR(Value);
This will produce the following output −
+-------+ | Value | +-------+ | 10.97 | | 20.04 | | 89.56 | +-------+ 3 rows in set (0.00 sec)
Advertisements