I'm creating advertise system, which should be shown on ATM. For now, I have to make a database structure where advertise, ATM and customer compliance will be stored.
Advertise system must choose an advertise depending on ATM and customer.
The point is that customer is not strictly defined. It can be filtered with any its property (card number, account, client ID, client age, ...). For example:
How Can I store these data in relational database?
I have one solution, but I don't like it, I will make a table were SQL where causes will be saved. For example:
advertise table
Adv_ID
Terminal_ID
Status (values can be: Allow/deny)
rule (here will be written SQL filter, for example: "card like '1111%' and client_id !=10230")
screen_id (on which page this adv must be shown) order (for adv priority)
Do you have any other suggestions?
You could try to design your configuration like this:
NUMBER
, VARCHAR
)NOT
(check-constraint)LIKE
, IN
(would cover =
and !=
but you can also add them explicitely)This would allow to generate all conditions while avoiding typos and SQL injection. I added data_type
to check when only numbers are allowed and when quotes need to be added/escaped.
adv column_name modifier operator values (shown denormalized)
2 atm IN 1
2 customer LIKE 1111%
3 atm NOT IN 1
3 clientID IN 1,2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With