New answers tagged


And I want to limit the number of referees on a single match to three, How can i do that? One method is with a trigger: CREATE TRIGGER tr_match_referee ON dbo.match_referee FOR INSERT, UPDATE AS IF EXISTS( SELECT 1 FROM inserted JOIN dbo.match_referee WITH (READCOMMITTEDLOCK) ON match_referee.id_match = inserted.id_match GROUP ...


It could be related to the value of foreign_key_checks variable. Try the following statement, and check the value: mysql> show variables like 'foreign_key_checks'; +--------------------+-------+ | Variable_name | Value | +--------------------+-------+ | foreign_key_checks | ON | +--------------------+-------+


You can make use of an EXCLUSION constraint and tsrange datatype instead of two timestamps. create table trip_segments ( segment_id serial primary key, travel_ts tstzrange, -- departure time to arrival time trip_id integer references trips (trip_id), EXCLUDE USING gist (trip_id WITH =, travel_ts WITH &&) ); -- first segment insert into ...


Setup: create table t3 (c1 number, c2 number); alter table t3 add supplemental log group sl1 (c1, c2) always; alter table t3 add constraint t3_uk unique (c1, c2); insert into t3 values (1, 2); commit; Try to drop the column: SQL> alter table t3 drop column c2; alter table t3 drop column c2 * ERROR at line 1: ORA-12991: ...

Top 50 recent answers are included