Top "Foreign-keys" questions

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

How to delete data from multiple tables?

I have these tables: event (evt_id, evt_code, reg_id) magnitude (mag_id, evt_id, value) trace (trace_id, …

sql postgresql foreign-keys sql-delete
Hibernate and H2 "Referential integrity constraint violation" for OneToMany bidirectional mapping

So I have two simple beans -- FatKid and Hamburgers. Now, for reasons unbeknownst to me I need to be …

hibernate foreign-keys one-to-many h2 bidirectional
Mysql - Add auto_increment to primary key

I have a strange problem with mysql. I am trying to alter a table's column which is a primary key …

mysql database foreign-keys auto-increment
Why to use foreign keys with no action on delete or update

I have a question of interest: I have 2 tables in mysql with InnoDb. table tbl_a has a primary key, …

mysql foreign-keys innodb myisam
Hibernate criteria query using Max() projection on key field and group by foreign primary key

I'm having difficulty representing this query (which works on the database directly) as a criteria query in Hibernate (version 3.2.5): SELECT …

hibernate group-by projection foreign-keys many-to-one
MySQL RESTRICT and NO ACTION

What's the difference in a MySQL FK between RESTRICT and NO ACTION? From the doc they seem exactly the same. …

mysql foreign-keys cascade
MongoDB normalization, foreign key and joining

Before I dive really deep into MongoDB for days, I thought I'd ask a pretty basic question as to whether …

mongodb foreign-keys normalization database nosql
MySQL errorno 121

I'm getting this error in MySQL create. I'm doing: CREATE TABLE `blogReply` ( `Id` INT(24) NOT NULL AUTO_INCREMENT COMMENT 'Primary …

mysql foreign-keys mysql-error-1005
How to create foreign key that is also a primary key in MySQL?

This should be a fairly straightforward question, but I'm unable to find an easy answer. How do you create a …

mysql inheritance foreign-keys primary-key
Hibernate Issue : Foreign key must have same number of columns as referenced primary key

Goal : I want to have importJobId in ImportJob as foreign key for id of allocation table, such that when we …

java sql hibernate foreign-keys composite-key