A Gentle Introduction to

SQL

INSERT, UPDATE and DELETE

How to put records into a table, change them and how to take them out again.


Cannot DELETE because of reference.
If a foreign key is set up between two tables it may be that you cannot delete a record. In this case the table t_staff references the table t_dept - you cannot delete the department 'co' if a member of staff belongs to that department.
oracle variations:
We can examine this constraint to find the table that has it...
SELECT constraint_name, table_name, status
FROM user_constraints
WHERE r_constraint_name IN (
     SELECT constraint_name
     FROM user_constraints
     WHERE table_name ='T_DEPT')

Possible error messages:
ORA-02292: integrity constraint (GISQ.SYS_C003351) violated - child record found

access
db2
mysql
oracle
postgres
sqlserver