Data type: Difference between revisions
Jump to navigation
Jump to search
m (→references) |
|||
Line 72: | Line 72: | ||
* [http://dev.mysql.com/doc/refman/5.0/en/data-types.html MySQL :: MySQL 5.0 Reference Manual :: 10 Data Types] | * [http://dev.mysql.com/doc/refman/5.0/en/data-types.html MySQL :: MySQL 5.0 Reference Manual :: 10 Data Types] | ||
* [http://msdn.microsoft.com/en-us/library/ms187594(SQL.90).aspx Data Types (Database Engine)] | * SQL Server 2005 [http://msdn.microsoft.com/en-us/library/ms187594(SQL.90).aspx Data Types (Database Engine)] | ||
[[Category:Web_Dev]] [[Category:Database]] [[Category:MySQL]] | [[Category:Web_Dev]] [[Category:Database]] [[Category:MySQL]] |
Revision as of 13:58, 14 June 2013
資料表欄位設計時,不同資料類型,建議採用的資料型態(data type)
examples of data and suggested datatype
- IP(v4):
- varchar(15)
- ex: 255.255.255.255 [3]
- range/limit:
- IP range - Classless inter-domain routing (CIDR)[4]
- 12 or 24 bytes (IPv4 and IPv6 networks)[5]
- ex: 69.208.0.0/32
- Chinese name:
- 最長姓名有13個字 [6]
- LINE姓名欄位長度限制: 15字(15個中文字或15英文字母)
- unix timestamp:
- bigint(10) ;
- ex: 1328664539
- range/limit:
- School ID defined by MOE at Taiwan / 學校代碼[7]
- integer: 4(university) ~ 6
- ex: 0001(國立政治大學)、373607(臺北市立華江國小)。前面可能有零。
- range/limit:
- 價錢/金額
- DECIMAL(10,2)[10]
- ex:
- range/limit: 0.00 ~ 99999999.99
- 台灣縣市欄位值 下拉式選單[11]
$city = array("基隆市", "台北市", "新北市", "桃園縣", "新竹市", "新竹縣", "苗栗縣", "台中市", "彰化縣", "南投縣", "雲林縣", "嘉義市", "嘉義縣", "台南市", "高雄市", "屏東縣", "台東縣", "花蓮縣", "宜蘭縣", "澎湖縣", "金門縣", "連江縣");
- 密碼
- varchar 允許最小8個字元長度[12]
(left blank intentionally) * data ** data type ** ex: ** range/limit:
comparision of datatypes in different database server
DATETIME: ex: "2013-06-13 03:33:33" MS SQL 2008, MySQL is equivalent
TIMESTAMP: MS SQL 2008 and MySQL is NOT equivalent[13]
- MS SQL 2008[14] ex: 0x00000000000007D3
- MySQL ex: 2013-06-13 03:33:33
references
- ↑ Range from 1905 ~ 2013 (108 yeas old) from the Sing-up form from outlook.com [Last visited: 2013-02-04]
- ↑ 最年長者 - 維基百科,自由的百科全書: 「根據金氏世界紀錄大全紀錄的最長壽者是活了122年的雅娜·卡爾曼特」
- ↑ Datatype for storing ip address in SQL Server - Stack Overflow
- ↑ Help:Range blocks - MediaWiki
- ↑ PostgreSQL: Documentation: Manuals: Network Address Types
- ↑ 中國新聞網 (2010). 台灣“獨一姓氏”者達149人 最長姓名有13個字_台灣頻道_新浪網-北美
- ↑ 各級學校名錄--教育部統計處 Department of Statistics[Last visited: 2012-02-16]
- ↑ mysql - What is the ideal data type for latitude / longitude? - Stack Overflow
- ↑ Creating a Store Locator with PHP, MySQL & Google Maps - Google Maps API Family - Google Code
- ↑ sql - Best Data Type for Currency - Stack Overflow[Last visited: 2012-03-07]
- ↑ 取自中華郵政全球資訊網
- ↑ Password length & complexity - OWASP "Minimum length. Passwords should be at least eight (8) characters long."
- ↑ SQL Server 2008 timestamp data type - Stack Overflow
- ↑ timestamp (Transact-SQL)