Автор работы: Пользователь скрыл имя, 21 Ноября 2010 в 16:57, Не определен
Создание базы данных SQL
select * from AVTO
where
/* %JoinFKPK(NEW,AVTO," = "," and") */
NEW.№_Avto = AVTO.№_Avto
) and
/* %JoinPKPK(MEXAN_AVTO,NEW," = "," and") */
;
/* ERwin Builtin Fri Dec 11 20:50:53 2009 */
/* MEXAN R/26 MEXAN_AVTO ON CHILD UPDATE SET NULL */
update MEXAN_AVTO
set
/* %SetFK(MEXAN_AVTO,NULL) */
MEXAN_AVTO.№_Mexanika = NULL,
MEXAN_AVTO.№_Sotrudnika = NULL
where
not exists (
select * from MEXAN
where
/* %JoinFKPK(NEW,MEXAN," = "," and") */
NEW.№_Mexanika = MEXAN.№_Mexanika and
NEW.№_Sotrudnika = MEXAN.№_Sotrudnika
) and
/* %JoinPKPK(MEXAN_AVTO,NEW," = "," and") */
;
/* ERwin Builtin Fri Dec 11 20:50:53 2009 */
END
!!
CREATE TRIGGER tI_SECRETAR FOR SECRETAR AFTER INSERT AS
/* ERwin Builtin Fri Dec 11 20:50:53 2009 */
/* INSERT trigger on SECRETAR */
DECLARE VARIABLE numrows INTEGER;
BEGIN
/* ERwin Builtin Fri Dec 11 20:50:53 2009 */
/* SCHTAT R/25 SECRETAR ON CHILD INSERT RESTRICT */
select count(*)
from SCHTAT
where
/* %JoinFKPK(NEW,SCHTAT," = "," and") */
NEW.№_Sotrudnika = SCHTAT.№_Sotrudnika into numrows;
IF (
/* %NotnullFK(NEW," is not null and") */
numrows = 0
) THEN
BEGIN
EXCEPTION ERWIN_CHILD_INSERT_RESTRICT;
END
/* ERwin Builtin Fri Dec 11 20:50:53 2009 */
END
!!
CREATE TRIGGER tU_SECRETAR FOR SECRETAR AFTER UPDATE AS
/* ERwin Builtin Fri Dec 11 20:50:53 2009 */
/* UPDATE trigger on SECRETAR */
DECLARE VARIABLE numrows INTEGER;
BEGIN
/* ERwin Builtin Fri Dec 11 20:50:53 2009 */
/* SCHTAT R/25 SECRETAR ON CHILD UPDATE RESTRICT */
select count(*)
from SCHTAT
where
/* %JoinFKPK(NEW,SCHTAT," = "," and") */
NEW.№_Sotrudnika = SCHTAT.№_Sotrudnika into numrows;
IF (
/* %NotnullFK(NEW," is not null and") */
numrows = 0
) THEN
BEGIN
EXCEPTION ERWIN_CHILD_UPDATE_RESTRICT;
END
/* ERwin Builtin Fri Dec 11 20:50:53 2009 */
END !!
Информация о работе Проектирование базы данных для торговца подержанными автомобилями