[关闭]
@gzm1997 2018-04-30T14:21:51.000000Z 字数 2323 阅读 715

系统分析与设计第五次作业

系统分析与设计


郭柱明 15331094


a. 阅读 Asg_RH 文档,按用例构建领域模型。

image_1ccb8abp9119l92iav21c8pg9u9.png-32.9kB


b. 数据库建模(E-R 模型)
- 按 Task 3 要求,给出系统的 E-R 模型(数据逻辑模型)
- 导出 Mysql 物理数据库的脚本
- 简单叙说 数据库逻辑模型 与 领域模型 的异同

image_1ccbeqlj3okh996tbi1b9j1h56m.png-60.6kB

代码如下

  1. /*==============================================================*/
  2. /* DBMS name: Sybase SQL Anywhere 12 */
  3. /* Created on: 2018/4/30 22:19:34 */
  4. /*==============================================================*/
  5. if exists(select 1 from sys.sysforeignkey where role='FK_USER_REFERENCE_RESERVAT') then
  6. alter table "user"
  7. delete foreign key FK_USER_REFERENCE_RESERVAT
  8. end if;
  9. drop table if exists busket;
  10. drop table if exists hotal;
  11. drop table if exists reservation;
  12. drop table if exists room;
  13. drop table if exists "user";
  14. /*==============================================================*/
  15. /* Table: busket */
  16. /*==============================================================*/
  17. create table busket
  18. (
  19. toltal_price integer not null,
  20. constraint PK_BUSKET primary key clustered (toltal_price)
  21. );
  22. /*==============================================================*/
  23. /* Table: hotal */
  24. /*==============================================================*/
  25. create table hotal
  26. (
  27. id integer not null,
  28. position varchar(60) not null,
  29. constraint PK_HOTAL primary key clustered (id)
  30. );
  31. /*==============================================================*/
  32. /* Table: reservation */
  33. /*==============================================================*/
  34. create table reservation
  35. (
  36. id integer not null,
  37. check_in_date date not null,
  38. check_out_date date not null,
  39. person_num integer not null,
  40. star integer null,
  41. toltal_price integer not null,
  42. constraint PK_RESERVATION primary key clustered (id)
  43. );
  44. /*==============================================================*/
  45. /* Table: room */
  46. /*==============================================================*/
  47. create table room
  48. (
  49. room_type varchar(30) not null,
  50. availability smallint not null,
  51. price integer not null,
  52. constraint PK_ROOM primary key clustered (room_type)
  53. );
  54. /*==============================================================*/
  55. /* Table: "user" */
  56. /*==============================================================*/
  57. create table "user"
  58. (
  59. name varchar(20) not null,
  60. password varchar(20) not null,
  61. email varchar(40) not null,
  62. id integer not null,
  63. constraint PK_USER primary key clustered (id)
  64. );
  65. alter table "user"
  66. add constraint FK_USER_REFERENCE_RESERVAT foreign key (id)
  67. references reservation (id)
  68. on update restrict
  69. on delete restrict;
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注