
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to specify Decimal Precision and scale number in MySQL database using PHPMyAdmin?
You need to select a database when you are creating a table. Right now, I have a sample database. The snapshot is as follows:
Now you need to give the table name as well as the number of columns you want:
After that you need to press Go button. Now, the following section would be visible:
The DECIMAL requires two parameter i.e. Total Number of Digit and second one is DigitAfterDecimalPoint.
The structure of DECIMAL is as follows:
DECIMAL(X,Y)
Here, X is TotalNumberOfDigit and Y is DigitAfterDecimalPoint.
Let us see an example:
DECIMAL(6,4)
Above, we will be having 6 digit sand 2 digit safter decimal point. For example, the valid range can be 24.5678 or 560.23 etc.
Here is the setup in phpmyAdmin. The snapshot is as follows:
After giving column name for a table, you need to use “Save” button. Here is the structure of table:
There are two columns in the table DecimalPrecisionDemo. One is Id which is of type int and second one is Amount of type DECIMAL(6,4).
- Related Articles
- How to add auto-increment to column in MySQL database using PhpMyAdmin?
- How to insert DECIMAL into MySQL database?
- How to store the PayPal decimal amount in the MySQL database?
- How to increase precision with division in MySQL?
- How to format number to 2 decimal places in MySQL?
- Connect to external server by using phpMyAdmin
- How to take MySQL database backup using MySQL Workbench?
- PHP – How to raise an arbitrary precision number to another using bcpow() function?
- PHP – How to subtract one arbitrary precision number from another using bcsub() function?
- Creating and Using a MySQL Database
- How to deal with floating point number precision in JavaScript?
- How to know the exact number of table and columns in a MySQL database?
- How can we specify the number of records to be returned in MySQL output?
- How to count the number of tables in a MySQL database?
- PHP – How to get the modulus of an arbitrary precision number using bcmod() function?
