Top "Foreign-keys" questions

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

Defining foreign key relationships for Rails' models

I have a Comment class with a :foreign_key of post_id in the Post class. class Comment < ActiveRecord::…

ruby-on-rails foreign-keys
composite key as foreign key

I am using Entity framework 4.1 in MVC 3 application. I have an entity where I have primary key consists of two …

c# entity-framework ef-code-first foreign-keys composite-key
SQL Server 2008: The columns in table do not match an existing primary key or unique constraint

I need to make some changes to a SQL Server 2008 database. This requires the creation of a new table, and …

sql sql-server foreign-keys foreign-key-relationship
Understanding ForeignKey attribute in entity framework code first

See the following post for some background: Entity framework one to zero or one relationship without navigation property I had …

c# entity-framework foreign-keys code-first shared-primary-key
Setting default value for Foreign Key attribute

What is the best way to set a default value for a foreign key field in a model? Suppose I …

django foreign-keys default
ForeignKey does not allow null values

I am using the Django REST Framework 2.0. Here is my model class: class Mission(models.Model): assigned_to = models.ForeignKey(…

django-rest-framework model foreign-keys serialization
Disabling foreign key constraint, still can't truncate table? (SQL Server 2005)

I have a table called PX_Child that has a foreign key on PX_Parent. I'd like to temporarily disable …

sql-server foreign-keys constraints
Disabling foreign key checks on the command line

I have a backup script for my MySQL database, using mysqldump with the --tab option so it produces a .sql …

mysql command-line foreign-keys mysqlimport
SqlAlchemy - Filtering by Relationship Attribute

I don't have much experience with SQLAlchemy and I have a problem, which I can't solve. I tried searching and …

python filter sqlalchemy foreign-keys
Can Foreign Key be null?

In our database project we have a table Sale that has an primary key and two exclusive foreign keys: Vehicle_…

sql oracle database-design foreign-keys data-integrity