Home Sql Mysql-example SQL Decimal



SQL Decimal
Posted on: January 24, 2009 at 12:00 AM
SQL Decimal is used to specify the values in decimal datatype.

SQL Decimal

     

SQL Decimal is used to specify the values in decimal datatype. The Decimal datatype can be of two types : Decimal (p) refers to floating point and Decimal fixed point (p,s). The DECIMAL data type can store decimal floating-point numbers up to a maximum of 32 significant digits and Decimal fixed point can store upto 16 significant digits.

Understand with Example

The Tutorial illustrate an example from 'SQL Decimal'. To understand and grasp the example we create a table 'emp' that has the required fieldnames and datatypes respectively.

Create table stu:

Create table emp( id int, name varchar(15), salary decimal(5));

Insert values:

The insert into is used to add the records to the table 'emp'.

insert into emp values (1,'Ajay',12000);
insert into emp values (2,'Bhanu',12000);
insert into emp values (3,'Komal',12000);
insert into emp values (4,'Rakesh',12000);

emp table

mysql> select * from emp;
+------+--------+--------+
| id   | name   | salary |
+------+--------+--------+
| 1    | Ajay   | 12000  |
| 2    | Bhanu  | 12000  |
| 3    | Komal  | 12000  |
| 4    | Rakesh | 12000  |
+------+--------+--------+
4 rows in set (0.02 sec)

Related Tags for SQL Decimal:
sqlcdatatypesfloatsedtypedecimalvalueintifpoivaluestopointdatatyperefcifixedecanusepeiminmntcaesspecrefersxespatisandvatwssthatialufefixndo


More Tutorials from this section

Ask Questions?    Discuss: SQL Decimal  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.