MySQL data type

Source: Internet
Author: User

First, the number type

A: Integral type

  

Mysql> Show CREATE TABLE A\g
1. Row ***************************
Table:a
Create table:create Table ' a ' (
' A ' int (ten) unsigned DEFAULT NULL,
' B ' int(TEN) unsigned DEFAULT NULL
) Engine=innodb DEFAULT charset=latin1
1 row in Set (0.00 sec)

Here's 10, what does that mean?

It doesn't make sense, it only works with Zerofill.

Mysql> CREATE TABLE C (a int (3) zerofill,b int (3) zerofill);
Query OK, 0 rows affected (0.16 sec)

mysql> INSERT into C select 1, 2;
Query OK, 1 row Affected (0.00 sec)
Records:1 duplicates:0 warnings:0

Mysql> select * from C;
+------+------+
| A | B |
+------+------+
| 001 | 002 |
+------+------+
1 row in Set (0.00 sec)

Mysql> Select a-B from C;
ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in ' (' TestDB '. ' C '. ' A '-' testDB '. ' C '. ' B ') '

mysql> INSERT into C select 1111;
ERROR 1136 (21S01): Column count doesn ' t match value count at row 1 (column count mismatch value counts)

MySQL data type

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.