A card is a value, not an entity.
Cards do not have identity -- if the pack contains two cards with the same value it is of no interest to identify them separately. They only have value.
Programming languages tend to provide values like integer, string and struct. You need to pick one of those to represent the value of a card. I would suggest using integer for the value, and write a class that can convert that integer to and from string or image representation, and to return the rank, suit and order (which may not be the same as the integer order).
Then your generator simply generates integers within a specified range.
The usual deck of cards contains 53 distinct cards, including a Joker. There are games (500) that have up to 63 distinct cards but the principle is the same, and an integer is a perfectly convenient way to encode the value. I would use that in the database too.
For a hand or a deal you have multiple cards, up to 13 in Bridge or 52 if you want to keep a complete deal. You could encode that as a space-separated list of integers or some other way, depending on what you need. That's getting off the original point.
This is a subtle issue, the representation of value types, and not easily addressed with an audience of widely different skills.