Data Types for data design in Java, Oracle, and MySQL

Source: Internet
Author: User
Java class MySQL Oracle Bytes Range
Character Char (1) Char (1) 2 0 ~ 65535
String Varchar (255) Varchar2 (255)    
String-clob Longtext Clob    
Date-date Date Date    
Date-time Time Date    
Date-Timestamp Datetime Date    
Boolen Tinyint (1) Number (1) 1 True | false
Byte Tinyint (4) Number (3) 1 -128 ~ 127
Short Smallint (6) Number (5) 2 -32768 ~ 32767
Integer INT (11) Number (10) 4 -2147483648 ~ 2147483647
Long Bigint (20) Number (19) 8 -9223372036854775808 ~ 9223372036854775807
Float Float Float 4 -3.4e38 ~ 3.4e38
Double Double Float 8 -1.7e308 ~ 1.7e308
Bigdecimal Decimal (19,2) Number (19,2)    
Byte []-blob Longblob Clob    

Use bigdecimal instead of float and double to avoid precision problems.

Boolean has many Representation Methods in the database, such as 0 | 1, Y | N, yes | no, or even Yes | no, so number (1) can be used ), char (1) or even varchar2

Why is the difference between MySQL and Oracle 1? after reading the following information, you should know:

Type

Bytes

Minimum value

Maximum Value

(Signed/unsigned)

(Signed/unsigned)

Tinyint

1

-128

127

0

255

Smallint

2

-32768

32767

0

65535

Mediumint

3

-8388608

8388607

0

16777215

Int

4

-2147483648

2147483647

0

4294967295

Bigint

8

-9223372036854775808

9223372036854775807

0

18446744073709551615

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.