Tag Info

New answers tagged

1

I'd suggest you have a think about this system's use cases. Work out in your own mind how the queries will look for the given design and for your alternative. Include scenarios where people move between slots. What do updates look like? Can business constraints be enforced in DRI? Can the desired values still be found? Having actual examples to talk ...


4

A simple CHECK constraint works just fine: $ sqlite SQLite version 3.8.4.1 2014-03-11 15:27:36 ... sqlite> CREATE TABLE table_B( ...> user1, ...> user2, ...> [other stuff], ...> CHECK (user2 < user1) ...> ); sqlite> INSERT INTO table_B VALUES (1, 0); sqlite> INSERT INTO table_B VALUES (2, 3); Error: ...


1

It's not eav - google "celko eav" Not sure about exact syntax, but CHECK (user1 > user2) or similar should work - it does in Firebird embedded. AIUI, SQLite doesn't support subqueries. This isn't one. The constraint will take care of your alice,bob-bob,alice issue. Paul...



Top 50 recent answers are included