Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

MySQL Decimal data field choice confusion

Featured Replies

Hi all,

 

I'm getting a bit confused here about how to configure a MySQL database table... can anyone help a newbie please!

 

I need to create a field that will take either a whole number or a decimal number up to no more than 5

 

i.e '1' or '2.5', '4', 4.5'

 

I have tried to use DECIMAL(1,1) UNSIGNED description but that seems to turn every entry I put into it (in phpMyAdmin) to 0.9 :o

 

Im confused.. can anyone point me in the right direction here?

 

Many thanks in advance

 

Chris

Hello

 

You could try using FLOAT. e.g. FLOAT(7,4) gives you display size of 7 with 4 digits after the decimal point. If you put FLOAT(1,1) MySQL will automatically make the display size 3 - It has to have the display size 2 digits bigger than the number of digits you require?????

 

Theres also DOUBLE which is for big fat long numbers and takes up twice as much storage(8 bytes).

 

Rob

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.