New answers tagged sqlite
4
votes
Accepted
In a SQL database, how can I add a unique constraint that depends on a value in a foreign key linked table?
A common trick is to add a unique constraint to physical_locations:
create table physical_locations
( physical_location_id char(2) not null -- primary key
, name varchar(20) not null
, district int ...
Top 50 recent answers are included
Related Tags
sqlite × 645database-design × 69
performance × 42
mysql × 39
postgresql × 35
select × 28
query-performance × 26
join × 26
index × 23
sql-server × 20
trigger × 20
foreign-key × 20
python × 18
query × 17
optimization × 16
insert × 16
subquery × 15
update × 13
primary-key × 12
group-by × 11
datatypes × 10
constraint × 10
aggregate × 9
table × 9
transaction × 8