【正文】
EXEC sp_droprole 39。EXEC sp_helprotect 39。CJW39。CJW39。CJW39。MC酒店前臺(tái)管理系統(tǒng)39。CJW39。,39。EXEC sp_adduser 39。EXEC sp_droprole 39。EXEC sp_droprole 39。,39。EXEC sp_adduser 39。,39。use MC酒店前臺(tái)管理系統(tǒng)gocreate role bjEXEC sp_addlogin 39。bj92112339。EXEC sp_helpsrvrolemember十五. 將部分登錄映射到你的數(shù)據(jù)庫(kù)中成為用戶。EXEC sp_dropsrvrolemember 39。EXEC sp_helpsrvrolememberEXEC sp_dropsrvrolemember 39。EXEC sp_addsrvrolemember 39。EXEC sp_addsrvrolemember 39。create login admin1 with password=39。創(chuàng)建登錄用戶create login bingjie921123 with password=39。 update ClientInfoset ClientConsume=2000where ClientID=39。 where ClientID=noToUpdate fetch next from UpdateHKUNoCursor into noToUpdate endendexec UpdateHKUNoclose UpdateHKUNoCursor 關(guān)閉deallocate UpdateHKUNoCursor drop procedure UpdateHKUNo 十二. 編寫一個(gè)實(shí)現(xiàn)修改表的觸發(fā)器,實(shí)現(xiàn)完整性控制。利用游標(biāo)進(jìn)行數(shù)據(jù)修改的存儲(chǔ)過(guò)程,將ClientInfo中所有女性的備注改為“女士可免費(fèi)參加舞會(huì)”create procedure UpdateHKUNo 存儲(chǔ)過(guò)程里面放置游標(biāo)as begindeclare UpdateHKUNoCursor cursor 聲明一個(gè)游標(biāo),查詢滿足條件的數(shù)據(jù)for select ClientID from ClientInfo where ClientSex=39。*39。create function clientsq(ClientID char(8))returns tableasreturn(select ClientID,ClientName,ClientCertificateID from ClientInfo Where ClientID=ClientID)goSELECT * FROM (39。寫出源代碼。After刪除數(shù)據(jù)delete from clientmaninfowhere ClientName LIKE 39。beforeAfterupdate freeroomset TypeName=39。beforeAfterupdate clientmaninfoset ClientName=39。,39。,39。,39。,39。,39。,39。九. 對(duì)視圖進(jìn)行插入、刪除、修改數(shù)據(jù)操作。select TypeName,SumConsumefrom zxfwhere SumConsume10000select ClientIDfrom clientmaninfowhere ClientName=39。男39。select RoomNo,StatusNo,RoomRemarksfrom RoomInfowhere TypeNo=(select TypeNo from RoomType where TypeName=39。USE MC酒店前臺(tái)管理系統(tǒng)GoSELECT ClientName from ClientInfoSELECT RoomNo from RoomInfo where StatusNo=1SELECT ,RoomNo,ClientName,ClientSex,ClientRemarks from ClientInfo,ReInfo where = select ClientSex,Count(ClientSex) as 人數(shù)from ClientInfo group by ClientSexSELECT TypeName,AVG(ClientConsume) AS 平均收入from RoomType,ClientInfo,ReInfo,RoomInfowhere = and = and =Group by TypeName Having AVG(ClientConsume)1000SELECT TypeNo from RoomInfo GROUP BY TypeNo HAVING COUNT(*)2SELECT RoomNo from RoomInfo WHERE TypeNo IN(SELECT TypeNo from RoomInfo GROUP BY TypeNo HAVING COUNT(*)2)SELECT * from RoomType where Price(SELECT AVG(Price) from RoomType)SELECT ClientName from ClientInfo where ClientSex=39。C000000439。C000000439。20110709 09:06:0739。20110713 19:06:0739。C000000339。20110704 19:06:0739。20110710 09:06:0739。C000000139。B000000139。A000000739??偨y(tǒng)套房39。單人房39??臻e39。不空閑39。39。39。39。對(duì)海鮮過(guò)敏39。中國(guó)北京市朝陽(yáng)路39。1982112339。女39。C000000339。20110719 19:06:0739。1878787444439。34222219880123002239。葉華39。每日:分前不要打掃其房間39。中國(guó)北京市朝陽(yáng)路39。1982112339。男39。C000000139。20110710 09:06:0739。592719526039。34222219930123002X39。馬冰潔39。,size=10,maxsize=25,filegrowth=5)創(chuàng)建表use MC酒店前臺(tái)管理系統(tǒng)Create table RoomStatus(StatusNo int Primary key,RoomStatus varchar(10) not null,StatusAmount int not null)Create table RoomType(TypeNo int Primary key,TypeName varchar(10) not null,TypeAmount int not null,Price money not null)CREATE TABLE RoomInfo(RoomNo int PRIMARY KEY,StatusNo int NOT NULL,TypeNo int NOT NULL,RoomRemarks varchar(40),foreign key (StatusNo) references RoomStatus(StatusNo)on update cascade,foreign key (TypeNo) references RoomType(TypeNo)on update cascade,)Create TABLE ClientInfo(ClientID char(8) PRIMARY KEY,ClientName varchar(30) not null,ClientSex char(4),ClientCertificateID varchar(18) not null,ClientBirthday datetime,ClientPhone varchar(12) not null,ClientBookOrNot int,ClientAdress varchar(50),ClientConsume money,PaymentTime datetime,ClientRemarks varchar(40),)CREATE TABLE LoginInfo(EmployeeId char(8) PRIMARY KEY,PassWord char(6) not null,Restricte int not null,)create table ReInfo(ClientID char(8) NOT NULL,RoomNo int NOT NULL, LiveDate datetime,OutDate datetime,DayNo AS OutDateLiveDate,primary key (RoomNo,ClientID),foreign key (RoomNo) references RoomInfo(RoomNo),FOREIGN