Top "Foreign-keys" questions

Foreign keys are a data integrity feature of relational (and SQL) databases.

MySQL cannot create foreign key constraint

I'm having some problems creating a foreign key to an existing table in a mysql database. I have the table …

mysql indexing foreign-keys
Inner join with multiple tables

I have these four tables: PRODUCTS --------- PRODUCT_ID PRODUCT_TITLE (other fields) COLORS --------- COLOR_ID COLOR_NAME MATERIALS …

sql join foreign-keys relational-database 3nf
Exact Meaning of MySQL's Foreign Key 'on delete restrict' Clause

I have two MySQL tables: collections and privacy_level. I define them with a foreign key relationship as such: CREATE …

mysql foreign-keys
MySQL Errno 150

I'm creating a few simple tables and I can't get passed this foreign key error and I'm not sure why. …

mysql foreign-keys mysql-workbench
SQL Server: Howto get foreign key reference from information_schema?

In SQL Server, how can I get the referenced table + column name from a foreign key? Note: Not the table/…

sql sql-server foreign-keys information-schema
Entity Framework on delete cascade

I have problem with deleting related rows in Entity Framework 4.1. I have tables with relations Book 1<--->* BookFormats …

c# entity-framework foreign-keys cascading-deletes
SQL drop table and re-create and keep data

On our original design we screwed up a foreign key constraint in our table. Now that the table is full …

sql sql-server foreign-keys sql-drop
Django: Set foreign key using integer?

Is there a way to set foreign key relationship using the integer id of a model? This would be for …

django optimization django-models foreign-keys
How to use an auto incremented primary key as a foreign key as well?

This is what I'm trying to do: I have 2 tables... CREATE TABLE `parent` ( `id` int(11) NOT NULL AUTO_INCREMENT, `data` …

mysql foreign-keys constraints auto-increment database-relations
Defining multiple Foreign Key for the Same table in Entity Framework Code First

I have two entities in my MVC application and I populated the database with Entity Framework 6 Code First approach. There …

asp.net-mvc entity-framework ef-code-first foreign-keys foreign-key-relationship