mysql update SET problem?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
adilmarwat2004
Forum Commoner
Posts: 44
Joined: Fri Sep 04, 2009 11:28 pm

mysql update SET problem?

Post by adilmarwat2004 »

I have mysql table name 'marks' contains 4 fields

id, name, marks, avg

I give the sql query to mysql table like that

Update marks SET avg = marks/550*100

which gives result but there is no decimal value like 70.35 it shows only 70.

How it is possible.
aravona
Forum Contributor
Posts: 347
Joined: Sat Jun 13, 2009 3:59 pm
Location: England

Re: mysql update SET problem?

Post by aravona »

What is your Marks set as?

Integer = Allows whole numbers between -32,768 and 32,767

You need to make sure your data type is right.

Single = Single precision floating-point. Will handle most decimals
Double = Double precision floating-point. Will handle most decimals

http://www.w3schools.com/SQl/sql_datatypes.asp
Post Reply