Hi,
INSERT INTO money (salary) VALUES ('100,000,000.00')
100,000,000.00 is stored as 100.00 in decimal (14,2).
I don't know what is wrong?
Thanks
Hi,
INSERT INTO money (salary) VALUES ('100,000,000.00')
100,000,000.00 is stored as 100.00 in decimal (14,2).
I don't know what is wrong?Thanks
do not punctuate numbers in input data
mysql suypports multiple data schema, language-specific and region specific
in many supported schema the comma is a decimal separator, the number is truncated 2 digits after the first valid decimal separator = 100.00
database code is meant to be machine readable, not human readable, so dont try to make it pretty in the database
do any formatting only on output.
number should be 100000000.00.
input validation should strip out any incorrect characters in the input data, and return to the input form for re-entry with a "did you mean" prompt (like google when you mis-spell)
without validation the database wont last very long till it falls over dead
(Likewise repair dates that these salaries refer to, store timestamps not text strings, for the same reasons)
Understood. Thanks. It works now.
Y'welcome
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.