Skip to content
Advertisement

Tag: foreign-keys

What’s the meaning of RESTRICT in Foreign Keys?

There is 4 cases: (For example I’m talking about ON DELETE) CASCADE: the referencing rows will be deleted automatically along with the referenced ones. SET NULL: the value of referencing record will be set to NULL automatically along with the referenced ones. NO ACTION: There will not be any change in the the referencing rows when the referenced ones are

PostgreSQL Foreign Key syntax

I have 2 tables as you will see in my PosgreSQL code below. The first table students has 2 columns, one for student_name and the other student_id which is the Primary Key. In my second table called tests, this has 4 columns, one for subject_id, one for the subject_name, then one for a student with the highest score in a

Advertisement