/* here is another row for the parts table */ insert into parts values ('10605', 'hammer', 30, 9.99, '003', sysdate); /* a DBMS can support database integrity on a number of levels -- supporting domain integrity means the DBMS won't let you insert a row whose attributes don't meet each attribute's physical domain and any domain constraints another level is referential integrity; ...are the values for foreign key attributes reasonable? DO they indeed reference a primary key in the referenced table? a DBMS supports referential integrity if it prevents foreign key attributes from having a value that is NOT a primary key currently in the referenced table */ /* this insert FAILS because it tries to insert an order with a non-existent part number */ insert into orders values ('111112', '11111111', '10606', sysdate, 6, 'B', 'F'); /* this one WILL work, it is for an existing part number */ insert into orders values ('111112', '11111111', '10603', sysdate, 6, 'B', 'F'); /* basic/simplest delete syntax to delete A row from a table DELETE FROM tblname WHERE bool_condition; ...delete the rows in tblname where bool_condition is true ...no WHERE clause? ALL rows in tblname are deleted...! */ /* I now cannot delete part 10603, because an order references it: (this FAILS) */ delete from parts where part_num = '10603'; AND when a table structure changes * there is not an autocommit when table contents change; NOTE that there is also a SQL command rollback; ... that UNDOES all of the changes SINCE the latest commit (you cannot go "back" further by repeating rollback...!!) */