¡¾°²²©Åàѵ±Ê¼Ç¡¿Oracle±ö¹Ý¹ÜÀíϵͳ(¶þ)
reate table hotel_t_Right(
rightid number primary key not null,--×ÔÔö
rightname varchar2(20) not null
);
create sequence seq_hotel_t_Right;
create or replace trigger tir_hotel_Right
before insert or update on hotel_t_Right for each row
begin
select seq_hotel_t_Right.nextval
into :new.Rightid from dual;
end;
/*±íÃû hotel_t_Roleright£¨½ÇɫȨÏÞ±í£©
ÁÐÃû ÃèÊö Êý¾ÝÀàÐÍ£¨¾«¶È·¶Î§£© ¿Õ/·Ç¿Õ Ô¼ÊøÌõ¼þ
rrid ±àºÅ NUMBER ·Ç¿Õ Ö÷¼ü£¨×ÔÔö£©
roleid Óû§±àºÅ NUMBER ·Ç¿Õ Íâ¼ü
rightid ȨÏÞ±àºÅ NUMBER ·Ç¿Õ Íâ¼ü*/
create table hotel_t_Roleright(
rrid number primary key not null,--×ÔÔö
roleid number not null references hotel_t_Role(roleid),
rightid number not null references hotel_t_Right(rightid)
);
create sequence seq_hotel_t_Roleright;
create or replace trigger tir_hotel_Roleright
before insert or update on hotel_t_Roleright for each row
begin
select seq_hotel_t_Roleright.nextval
into :new.rrid from dual;
end;
/*±íÃû hotel_t_Userrole£¨Óû§½ÇÉ«±í£©
ÁÐÃû ÃèÊö Êý¾ÝÀàÐÍ£¨¾«¶È·¶Î§£© ¿Õ/·Ç¿Õ Ô¼ÊøÌõ¼þ
urid ±àºÅ NUMBER ·Ç¿Õ Ö÷¼ü£¨×ÔÔö£©
roleid Óû§±àºÅ NUMBER ·Ç¿Õ Íâ¼ü
rightid ȨÏÞ±àºÅ NUMBER ·Ç¿Õ Íâ¼ü*/
create table hotel_t_Userrole(
urid number primary key not null,--×ÔÔö
roleid number not null references hotel_t_Role(roleid),
rightid number not null references hotel_t_Right(rightid)
);
create sequence seq_hotel_t_Userrole;
create or replace trigger tir_hotel_Userrole
before insert or update on hotel_t_Userrole for each row
begin
select seq_hotel_t_Userrole.nextval
into :new.urid from dual;
end;
/*Ö÷Òª¹¦ÄÜÄ£¿éÉæ¼°µÄÊý¾Ý±íµÄ¹ØÏµÍ¼£º
2. ¿Í·¿»ù±¾ÐÅÏ¢¹ÜÀí
¿Í·¿¹ÜÀíÖ÷ÒªÊǰ´¿Í·¿µÄÌõ¼þ²»Í¬£¬¶Ô¿Í·¿½øÐзÖÀࣨÀýÈç·Ö³É±ê×¼¼äºÍºÀ»ª¼ä£©£¬Ã¿Ò»ÀàÖÆ¶¨Ò»¸ö±ê¼Û£¬µ«Êµ¼ÊÉÏÕâ¸ö±ê¼ÛºÜÉÙ°´ÕÕÖ´ÐУ¬ÎªÁËӺϿÍÈËÐÄÀí£¬¸÷¸ö±ö¹ÝÒ»°ã¶¼»á¶Ô±ê¼Û½øÐдòÕÛ£¬¼´±ãÕâÑù£¬ÓеĿÍÈË¿ÉÄÜ»¹²»ÂúÒ⣬»òÕßÊÇ´òÕÛºó³öÏÖÁãÇ®µÄÏÖÏ󣬱ö¹ÝÒ»°ã»á¸ø½Ó´ýÈËÔ±Ò»¸öÈü۵ÄȨÀû£¬µ«ÊÇÕâ¸öÈü۲»ÄÜÊÇÎÞÏ޶ȵģ¬Òò´Ë»¹ÐèÒª¶ÔÿÀà·¿¼ä¶¨Ò»¸ö×îµÍ¼Û
±íÃû hotel_t_Roomtype£¨¿Í·¿ÀàÐÍ±í£©
ÁÐÃû ÃèÊö Êý¾ÝÀàÐÍ£¨¾«¶È·¶Î§£
© ¿Õ/·Ç¿Õ Ô¼ÊøÌõ¼þ
typeid ÀàÐͱàºÅ NUMBER ·Ç¿Õ Ö÷¼ü£¨×ÔÔö£©
typename ÀàÐÍÃû³Æ VARCHAR2(20) ·Ç¿Õ
mardedprice ±ê¼Û NUMBER(12,2) ¿Õ
scale ÕÛ¿Û±ÈÂÊ NUMBER(5,4) ¿Õ
lowestprice ×îµÍÕÛ¿Û¼Û NUMBER(12,2) ¿Õ */
create table hotel_t_Roomtype(
typeid NUMBER primary key not null, --×ÔÔö
typename VARCHAR2(20) not null,
mardedprice NUMBER(12,2),
scale NUMBER(5,4),
lowestprice NUMBER(12,2)
)
create sequence seq_hotel_t_Roomtype;
create or replace trigger tir_hotel_Roomtype
before insert or update on hotel_t_Roomtype for each row
begin
select seq_hotel_t_Roomtype.nextval
into :new.typeid from dual;
end;
/*±íÃû hotel_t_Room£¨¿Í·¿ÐÅÏ¢±í£©
ÁÐÃû ÃèÊö Êý¾ÝÀàÐÍ£¨¾«¶È·¶Î§£© ¿Õ/·Ç¿Õ Ô¼ÊøÌõ¼þ
roomid ·¿ºÅ VARCHAR2(10) ·Ç¿Õ Ö÷¼ü
typeid ÀàÐͱàºÅ NUMBER ¿Õ Íâ¼ü
layer Â¥²ã VARCHAR2(20) ¿Õ
bednumber ´²Î»Êý NUMBER ¿Õ
state ״̬ NUMBER ·Ç¿Õ 0±íʾ¿ÕÏУ¬1±íʾÈëס£¬2±íʾԤÁô£¬Ä¬ÈÏΪ0*/
create table hotel_t_Room(--£¨¿Í·¿ÐÅÏ¢±í£©
--ÁÐÃû ÃèÊö Êý¾ÝÀàÐÍ£¨¾«¶È·¶Î§£© ¿Õ/·Ç¿Õ Ô¼ÊøÌõ¼þ
roomid VARCHAR2(10) primary key,-- ·Ç¿Õ Ö÷¼ü
typeid NUMBER references hotel_t_Roomtype(typeid),-- ¿Õ Íâ¼ü
layer VARCHAR2(20),-- ¿Õ
bednumber NUMBER,-- ¿Õ
state NUMBER default 0 check(state in (0,1,2)) not null --0±íʾ¿ÕÏУ¬1±íʾÈëס£¬2±íʾԤÁô£¬Ä¬ÈÏΪ0
);
/*3. Ô¤¶©¹ÜÀíÄ£¿é
Ô¤¶©¹ÜÀíÖ÷Òª°üÀ¨µÇ¼Ç¿ÍÈ˵ÄÔ¤¶©ÐÅÏ¢£¬²éѯԤ¶©ÐÅÏ¢£¬Í¬Ê±»¹ÐèҪעÒâÔ¤¶©ÐÅÏ¢²»ÄܳöÏÖ³åÍ»ÏÖÏó£¬ÀýÈçÁ½¸ö¿ÍÈ˶¼Ô¤¶©ÁËͬһÌìµÄͬһ¸ö·¿¼ä£¬ÕâÊDz»ÔÊÐíµÄ£»´ËÍ⣬ÔÚ¿ìµ½Ô¤¶©Ê±È·¶¨µÄ¿ÍÈËÔ¤µÖʱ¼äʱ£¬½Ó´ýÈËÔ±Òª´òµç»°Ö¤Ã÷¿ÍÈËÊÇ·ñÄܰ´Ê±Èëס£¬Èç¹û²»ÄÜ£¬¾Í»á°ÑÔ¤¶©µ¥×÷·Ï£¬»òÕß³ÆÎªÊ§Ð§£»
±íÃû hotel_t_Predestine£¨Ô¤¶©ÐÅÏ¢±í£©
ÁÐÃû ÃèÊö Êý¾ÝÀàÐÍ£¨¾«¶È·¶Î§£© ¿Õ/·Ç¿Õ Ô¼ÊøÌõ¼þ
predid Ô¤¶©µ¥ºÅ CHAR(16) ·Ç¿Õ Ö÷¼ü
roomid ·¿ºÅ VARCHAR2(10) ·Ç¿Õ
whenpred Ô¤¶©Ê±¼ä DATE ·Ç¿Õ
whopred Ô¤¶©ÈË VARCHAR2(20) ·Ç¿Õ
phone ÁªÏµ·½Ê½ VARCHAR2(20) ·Ç¿Õ
arrivetime Ô¤µÖʱ¼ä DATE ·Ç¿Õ
leavetime Ô¤Àëʱ¼ä DATE ·Ç¿Õ
trueprice ·¿¼Û NUMBER(12,2)
state ״̬ NUMBER ·Ç¿Õ ȡֵ·¶Î§Îª0¡¢1ºÍ2£¬0±íʾÓÐЧ£¬1±íʾÈëס£¬2±íʾʧЧ£¬Ä¬ÈÏΪ0*/
crea