PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, August 12, 2022

[FIXED] How to insert numbers with decimal point in Postgresql database table?

 August 12, 2022     decimal, postgresql, sql, sqldatatypes     No comments   

Issue

Numeric datatype doesn't accept decimal points in numbers and PgAdmin 4.2 don't have decimal data type. I want to add percentage numbers like 4.8 and latitude, longitudes something like -89.03177649999999 this. Which is the best data type in postgresql for this king of numbers. PgAdmin only allows numeric datatype to use for numbers. If I add this numbers with numeric data type it throws errors.


Solution

You can absolutely insert values with a decimal point into a numeric column:

create table data (nr decimal);
insert into data 
values 
(-89.03177649999999);

Online example: https://rextester.com/VQB54123



Answered By - a_horse_with_no_name
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing