상세 컨텐츠

본문 제목

과제~

청강컴정/DataBase

by luckey 2009. 4. 6. 23:49

본문



create table BankBook
(
 bankCode int primary key identity(1,1),
 bankName nvarchar(10) not null,
 bankNum varchar(20) not null,
)

create table event
(
 evCode int primary key identity(1,1),
 evTitle nvarchar(50) not null,
 evStart datetime not null,
 evDay tinyint default(1),
 evMoney money default(0),
 bankCode int foreign key references BankBook(bankCode)
)

create table payment
(
 payTitle nvarchar(50) not null,
 payMemo nvarchar(500),
 payMoney money default(0),
 payReceive bit default(0),
 payExDate datetime not null,
 payRegDate datetime default getdate(),
 evCode int foreign key references event(evCode)
)

create table support
(
 suMoney money default(0),
 suTitle nvarchar(10),
 suDate datetime not null,
 evCode int foreign key references event(evCode)
)

create table student
(
 stdNum int primary key,
 stdName nvarchar(5),
 stdType tinyint default(0)
)

create table manage
(
 evCode int foreign key references event(evCode),
 stdNum int foreign key references student(stdNum),
 maDate datetime not null
)

begin
insert into bankBook values ('학과비', '494-910166-98007')
insert into bankBook values ('학과비(기타)', '190-810594-83007')
end

begin
-- evCode int primary key identity(1,1),
-- evTitle nvarchar(50) not null,
-- evStart datetime not null,
-- evDay tinyint default(1),
-- evMoney money default(0),
-- bankCode int foreign key references BankBook(bankCode)
insert into event values ('졸업여행', cast('2009-04-09' as datetime), 4, 100000, 2)
end

관련글 더보기

댓글 영역