mysql - How do I conduct referencial integrity using foreign key constraints in netbeans sql? -
i trying write sql code in netbeans. have 2 tables:
create table building( building_name varchar(10) not null primary key, building_location varchar(20), building_room_number integer); insert building values('building a', 'location a',34); insert building values('building b','location b',45); insert building values('building c', 'location c',40); create table room( room_number integer primary key, building_name varchar(10)); insert room values(1, 'building a'); insert room values(2, 'building b'); insert room values(3, 'building c');
then want create foreign key conduct referential integrity.
alter table room add constraint fk_room foreign key (building_name) references building(building_name) on delete restrict on update cascade;
netbeans kept giving me error
[exception, error code 905, sqlstate 42000] ora-00905: missing keyword
i m not sure what's wrong syntax. how should write foreign key constrains in netbeans sql?
thank help><
your syntax correct in mysql.
the error log posted looks oracle log. sure executing alter
statement in , incorrect netbeans tab?
Comments
Post a Comment