【正文】
5:圖書館管理系統(tǒng) CDM 建模 ( 2) 數(shù)據(jù)庫物理數(shù)據(jù)模型 PDM對象如下圖,該圖顯示了各實體的屬性及各實體之間的關(guān)系。 附:由 PDM 對象自動生成的數(shù)據(jù)庫腳本文件代碼如下: 16 /*==============================================================*/ /* DBMS name: Microsoft SQL Server 2020 */ /* Created on: 2020/6/15 星期六 10:34:13 */ /*==============================================================*/ if exists (select 1 from r join o on ( = and = 39。) where = object_id(39。) and = 39。) alter table books drop constraint FK_BOOKS_RELATIONS_ADMIN go if exists (select 1 from r join o on ( = and = 39。) where = object_id(39。) and = 39。) alter table books drop constraint FK_BOOKS_BOOKTYPE_BOOK_TYP go if exists (select 1 from r join o on ( = and = 39。) where = object_id(39。) and = 39。) alter table borrow_information drop constraint FK_BORROW_I_REFERENCE_READER go if exists (select 1 from r join o on ( = and = 39。) where = object_id(39。) and = 39。) alter table borrow_information drop constraint FK_BORROW_I_BORROW_BO_BOOKS go if exists (select 1 from r join o on ( = and = 39。) where = object_id(39。) and = 39。) 17 alter table login drop constraint FK_LOGIN_RELATIONS_ADMIN go if exists (select 1 from r join o on ( = and = 39。) where = object_id(39。) and = 39。) alter table login drop constraint FK_LOGIN_RELATIONS_READER go if exists (select 1 from r join o on ( = and = 39。) where = object_id(39。) and = 39。) alter table reservation drop constraint FK_RESERVAT_RELATIONS_READER go if exists (select 1 from r join o on ( = and = 39。) where = object_id(39。) and = 39。) alter table reservation drop constraint FK_RESERVAT_RESERVED__BOOKS go if exists (select 1 from sysobjects where id = object_id(39。) and type = 39。) drop table admin go if exists (select 1 from sysobjects where id = object_id(39。) and type = 39。) drop table book_type go 18 if exists (select 1 from sysindexes where id = object_id(39。) and name = 39。 and indid 0 and indid 255) drop index go if exists (select 1 from sysindexes where id = object_id(39。) and name = 39。 and indid 0 and indid 255) drop index go if exists (select 1 from sysobjects where id = object_id(39。) and type = 39。) drop table books go if exists (select 1 from sysobjects where id = object_id(39。) and type = 39。) drop table borrow_information go if exists (select 1 from sysobjects where id = object_id(39。) and type = 39。) drop table login go if exists (select 1 from sysobjects where id = object_id(39。) and type = 39。) drop table reader 19 go if exists (select 1 from sysobjects where id = object_id(39。) and type = 39。) drop table reservation go isql go isql go isql go isql go isql go isql go isql go alter table books add constraint FK_BOOKS_RELATIONS_ADMIN foreign key (admin_id) references admin (admin_id) go alter table books add constraint FK_BOOKS_BOOKTYPE_BOOK_TYP foreign key (admin_id) references book_type (type_id) go alter table borrow_information add constraint FK_BORROW_I_REFERENCE_READER foreign key (reader_id) references reader (reader_id) go 20 alter table borrow_information add constraint FK_BORROW_I_BORROW_BO_BOOKS foreign key (book_id) references b