PROJECT 4 Build A Periodic Table Database
- You should remove all the trailing zeros after the decimals from each row of the atomic_mass column. You may need to adjust a data type to DECIMAL for this. Be careful not to change the value
I just came to a point which includes removing trailing zeros, but everytime I try to change datatype or else it just doesn’t work. Either I loose value or not working at all even if it works data still shown like this: I even tried the INSERT method still same.
1.0080 4.0026 6.9400 9.0122 10.8100 12.0110
Needed values for properties(atomic_mass) are like down below right?
(No trailing zeros)
1.008 4.0026 6.94 9.0122 10.81 12.011 14.007 15.9990 1
Because I looked many places…
UPT ... SET ... atomic_mass= CAST(fn...)
or with —>
UPT... ::numeric version which gave me no errors when inputting
UPDATE ... TRUNC(atomic_mass,SCALE(atomic_mass)) ALTER TABLE ... ALTER COLUMN ... SET TYPE DECIMAL(precision,scale) . ....NUMERIC(precision,scale)
Many many more …
Then I also needed to create a bash script for the broken properties table truncating old data then enter recovery data again and again…
By the way, I also checked the documentation for this with math functions
also there were a code
trim_scale(..I dont know its usage.., its not recognized by the v12.9 PSQL) works above v13 Psql but version in VM psql 12.9.
Here is a website which they discussed about this problem:
Am I missing something?