Top "Referential-integrity" questions

Referential integrity is a property of data which requires the value of an attribute/column of a relation table to exist as a value of another attribute/column in another relation table

What's wrong with foreign keys?

I remember hearing Joel Spolsky mention in podcast 014 that he'd barely ever used a foreign key (if I remember correctly). …

database database-design foreign-keys referential-integrity data-integrity
Create unique constraint with null columns

I have a table with this layout: CREATE TABLE Favorites ( FavoriteId uuid NOT NULL PRIMARY KEY, UserId uuid NOT NULL, …

sql postgresql database-design null referential-integrity
MySQL foreign key to allow NULL?

I'm piecing together an image website. The basic schema's pretty simple MySQL, but I'm having some trouble trying to represent …

mysql database null foreign-keys referential-integrity
mysql Multiple Foreign Keys in a Table to the Same Primary Key

I have a table user with userID as the primary key. I have another table called Friends. In the Friends …

mysql sql foreign-keys primary-key referential-integrity
(doctrine2 + symfony2) cascading remove : integrity constraint violation 1451

First, sorry for my poor English... I got four entities : User, Application, Bundle & Entity. Here are their relations (with …

symfony doctrine-orm cascading referential-integrity
Rails: delete cascade vs dependent destroy

Assuming I have two tables: users and orders. A user has many orders, so naturally there is a foreign key …

ruby-on-rails postgresql referential-integrity
SQL Server foreign key to multiple tables

I have the following database schema: members_company1(id, name, ...); members_company2(id, name, ...); profiles(memberid, membertypeid, ...); membertypes(id, name, ...) [ { …

sql sql-server tsql foreign-keys referential-integrity
CONSTRAINT to check values from a remotely related table (via join etc.)

I would like to add a constraint that will check values from related table. I have 3 tables: CREATE TABLE somethink_…

postgresql database-design foreign-keys constraints referential-integrity
In MySQL, can I defer referential integrity checks until commit

As in this question, I've been reading PoEAA and wondering if it's possible to defer referential integrity checks until commit …

mysql referential-integrity
SET CONSTRAINTS ALL DEFERRED not working as expected

In a PostgreSQL 9.3 database, if I define tables a and b as follows: CREATE TABLE a(i integer); ALTER TABLE …

sql postgresql database-design foreign-keys referential-integrity