I have got an issue relevant databases that we aren't able to find the anwser personally. Presently i acquired a scenario where i've got a database with two tables. The 2 tables are named products and products_sequences. What i wish to do is create a relationship between your primary key from the item database along with a area within the products_sequences table. Below an highlighted example.

| Items |          |  items_sequences |          
|-------|          |------------------|          
|  id   |          | sequence_id      |          
|  foo  |          | counter          |   

The thing is creating the connection is not hard. But what i wish to do if the Item is created a product sequence ought to be also made that contains a sequence_id using the primary key from the Item itself. And when a Item is erased the product_sequence ought to be erased too. Incidentally this ought to be single:1 relationship.

I didn't remember how you can do this, i'd really appreciate if a person would point me right direction. Presently i'm utilizing a postgresql database whether it matters.



Whether it's single:1 relationship, would you not only mix the tables?

Basically understand this right, you need to consider using foreign keys and triggers.