2

Which data type should I use to store a number(ID) like "10196385171799537224"(21 digits) in MySQL database?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Saliha Uzel
  • 141
  • 2
  • 5
  • 17
  • try checking out this question! it helps http://stackoverflow.com/questions/1211413/storing-very-large-integers-in-mysql – Bala Sep 29 '12 at 14:05

2 Answers2

5

You can store it as numeric(21,0)

See SQL Fiddle Demo

John Woo
  • 258,903
  • 69
  • 498
  • 492
4

Per the MySQL docs, you'd need a NUMERIC(21,0).

However, that's a unfeasibly large ID. Adding entries at a rate of one per microsecond, it would take over 300,000 years to reach that number. You might want to reconsider your design.

Dancrumb
  • 26,597
  • 10
  • 74
  • 130