Top "Foreign-keys" questions

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

How to update primary key

Here is my problem - I have 2 tables: WORKER, with columns |ID|OTHER_STAF| , where ID is primary key FIRM, …

sql-server sql-server-2008 foreign-keys composite-primary-key
Meaning of "n:m" and "1:n" in database design

In database design what do n:m and 1:n mean? Does it have anything to do with keys or relationships?

mysql database foreign-keys relationship
Error Code: 1005. Can't create table '...' (errno: 150)

I searched for a solution to this problem on the Internet and checked the Stack Overflow questions, but none of …

mysql foreign-keys mysql-error-1005
Foreign key referring to primary keys across multiple tables?

I have to two tables namely employees_ce and employees_sn under the database employees. They both have their respective …

sql foreign-keys primary-key
Force drop mysql bypassing foreign key constraint

I'm trying to delete all tables from a database except one, and I end up having the following error: Cannot …

mysql foreign-keys sql-drop
Foreign key constraints: When to use ON UPDATE and ON DELETE

I'm designing my database schema using MySQL Workbench, which is pretty cool because you can do diagrams and it converts …

mysql sql database foreign-keys
How to add composite primary key to table

create table d(id numeric(1), code varchar(2)) After I create the above table how can I add a composite primary …

sql sql-server-2005 foreign-keys primary-key
MySQL - Cannot add or update a child row: a foreign key constraint fails

This seems to be a common error, but for the life of me I can't figure this out. I have …

mysql foreign-keys mysql-error-1452
Delete rows with foreign key in PostgreSQL

I would like to delete rows which contain a foreign key, but when I try something like this: DELETE FROM …

sql postgresql foreign-keys cascading-deletes
How to change the foreign key referential action? (behavior)

I have set up a table that contains a column with a foreign key, set to ON DELETE CASCADE (delete …

mysql foreign-keys foreign-key-relationship