Top "Foreign-keys" questions

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

MySQL: Creating table with FK error (errno 150)

I've created a model with MySQL Workbench and am now attempting to install it to a mysql server. Using File &…

mysql foreign-keys innodb mysql-error-1005
Referencing a composite primary key

I have two tables, with each table having a composite primary key. One attribute is in both composite primary keys. …

sql oracle foreign-keys primary-key composite-primary-key
Specify ON DELETE NO ACTION in ASP.NET MVC 4 C# Code First

How do I specify ON DELETE NO ACTION Foreign Key Constraint in my model designs? At present, I have: public …

c# asp.net-mvc entity-framework foreign-keys code-first
Inserting new records with one-to-many relationship in sqlalchemy

I'm following the flask-sqlalchemy tutorial on declaring models regarding one-to-many relationship. The example code is as follows: class Person(db.…

python sqlalchemy foreign-keys relationship flask-sqlalchemy
Renaming foreign-key columns in MySQL

We're trying to rename a column in MySQL (5.1.31, InnoDB) that is a foreign key to another table. At first, we …

sql mysql foreign-keys mysql-error-1025
Can you automatically create a mysqldump file that doesn't enforce foreign key constraints?

When I run a mysqldump command on my database and then try to import it, it fails as it attempts …

mysql foreign-keys mysqldump data-import
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
PostgreSQL: SQL script to get a list of all tables that has a particular column as foreign key

I'm using PostgreSQL and I'm trying to list all the tables that have a particular column from a table as …

sql database postgresql foreign-keys
Schema specified is not valid. Errors: The relationship was not loaded because the type is not available

I wish to reference the OrderAddress model twice in my Order model; once as a ShippingAddress and once as a …

c# asp.net-mvc entity-framework foreign-keys fluent
PostgreSQL array of elements that each are a foreign key

I am attempting to create a DB for my app and one thing I'd like to find the best way …

postgresql foreign-keys foreign-collection