-2

How can I insert a range of cards like AA-QQ (AA, KK, QQ) in a cell of a database?

I will use Java.

I can't use 2 columns like in this answer because cards aren't numbers.

EDIT:

Maybe I found. I can do a join.

Second table:

ID  CARD1  CARD2  CARD3
--  -----  -----  -----
1   AA     KK     QQ

But if I have four pair of card in next row?

Community
  • 1
  • 1
huberton
  • 1
  • 4

1 Answers1

0

The best practice would be to use two tables for this purpose.

MainTable:
Id    rest of the approoriate fields
1        ...........
2        ............

Card Event Table:
id main_table_id           order   card
1     1                      1       kk
2     1                      2       qq
3     1                      3       JJ
4     1                      4       AA

Here you can use foreign key to point to MainTable id. That way you dont have to bother about number of cards

Mustofa Rizwan
  • 10,215
  • 2
  • 28
  • 43