sql - Storing fixed number of items in mysql -


i storing draw numbers (1-60) in fixed values , fixed order.

one draw has 4 numbers
has 6 numbers
, 2 numbers

my idea separate each draw type in separate sql table. question is, optimal store numbers in single column separated delimiter....

id(int) | numbers(varchar) 

or store each number in separate column instead?

id(int) | num1(tinyint) | num2(tinyint) | num3(tinyint) | num4(tinyint) 

i won't needing search numbers when they're stored.

if don't ever need search them separately or retrieve them separately, 1 opaque "blob" database perspective , won't violating principle of atomicity , 1nf storing them single filed.

but, because that's case now, doesn't mean won't change in future. @ least use second option. also, allow dbms enforce integrity of domain , ensure these numbers , strings.

however, future-proof data, i'd go further , use following structure:

enter image description here

in addition treating numbers in uniform way , avoiding many nulls, it'll allow vary max. number of numbers if ever becomes necessary. suspect querying easier in structure.

btw, if there no (other fields) , draw cannot exist without @ least 1 number, can dispense draw table altogether , use draw_number.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -