Mysql資料類型

來源:互聯網
上載者:User

標籤:mysql   資料類型   


mysql中的資料類型:


整數型:

#查看int整數型的協助。

mysql> ? intName: ‘INT‘Description:INT[(M)] [UNSIGNED] [ZEROFILL]A normal-size integer. The signed range is -2147483648 to 2147483647.The unsigned range is 0 to 4294967295.URL: http://dev.mysql.com/doc/refman/5.6/en/numeric-type-overview.html

#查看建立資料庫的協助,這塊發現使用schema不識別。

mysql> help create schemaNothing foundPlease try to run ‘help contents‘ for a list of all accessible topics


#可以使用help ? \h 三選一查看協助。

mysql> help create databaseName: ‘CREATE DATABASE‘Description:Syntax:CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name    [create_specification] ...create_specification:    [DEFAULT] CHARACTER SET [=] charset_name  | [DEFAULT] COLLATE [=] collation_nameCREATE DATABASE creates a database with the given name. To use thisstatement, you need the CREATE privilege for the database. CREATESCHEMA is a synonym for CREATE DATABASE.URL: http://dev.mysql.com/doc/refman/5.6/en/create-database.html


mysql> ? tinyintName: ‘TINYINT‘Description:TINYINT[(M)] [UNSIGNED] [ZEROFILL]A very small integer. The signed range is -128 to 127. The unsignedrange is 0 to 255.URL: http://dev.mysql.com/doc/refman/5.6/en/numeric-type-overview.html


mysql> \h intName: ‘INT‘Description:INT[(M)] [UNSIGNED] [ZEROFILL]A normal-size integer. The signed range is -2147483648 to 2147483647.The unsigned range is 0 to 4294967295.URL: http://dev.mysql.com/doc/refman/5.6/en/numeric-type-overview.html


浮點類型:

M是數字總位元,D是小數點後面的位元。

float(M,D)



字串類型:

char(M) M個位元組,0-255

varchar(M) L+1個位元組,0-65535



日期時間類型:

time

date

datetime

year



#查看mysql有那些儲存引擎(預設是innodb)

mysql> show engines;+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         || CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         || MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         || BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         || MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         || FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       || ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         || InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        || PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+9 rows in set (0.00 sec)




#查看顯示支援的儲存引擎的資訊:

mysql> show variables like ‘have%‘;+----------------------+----------+| Variable_name        | Value    |+----------------------+----------+| have_compress        | YES      || have_crypt           | YES      || have_dynamic_loading | YES      || have_geometry        | YES      || have_openssl         | DISABLED || have_profiling       | YES      || have_query_cache     | YES      || have_rtree_keys      | YES      || have_ssl             | DISABLED || have_symlink         | DISABLED |+----------------------+----------+10 rows in set (0.00 sec)





本文出自 “LINUX Super夢” 部落格,請務必保留此出處http://215687833.blog.51cto.com/6724358/1905770

Mysql資料類型

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.