
drop table MUSER	;
create table MUSER (
	USERID CHAR(20),
	USERNAME TEXT,	
	PASSWORD TEXT,	
	MAILADDRESS VARCHAR(100),
	SEXKBN CHAR(1),
	CITYCD CHAR(2),
	primary key (USERID)
);
drop table MUSERHOBBY	;
create table MUSERHOBBY (
	USERID CHAR(20),
	HOBBYCD CHAR(4),
	primary key (USERID,HOBBYCD)
);

drop table MCITY	;
create table MCITY(
	CITYCD CHAR(4),
	CITYNM CHAR(20),
	primary key (CITYCD)
);

insert into MCITY values('01','東京都');
insert into MCITY values('02','神奈川県');
insert into MCITY values('03','千葉県');
insert into MCITY values('04','埼玉県');


drop table MHOBBY	;
create table MHOBBY(
	HOBBYCD CHAR(4),
	HOBBYNM CHAR(20),
	primary key (HOBBYCD)
);
insert into MHOBBY values('0001','読書');
insert into MHOBBY values('0002','料理');
insert into MHOBBY values('0003','ドライブ');
insert into MHOBBY values('0004','スポーツ');


create sequence TOPICID;
create sequence TOPICRESID;

drop table CATEGORY	;
create table CATEGORY(
	CATEGORYCD	CHAR(5),
	CATEGORYNAME CHAR(20),
	CRTDTTM TIMESTAMP,
	primary key (CATEGORYCD)
);
insert into CATEGORY values('test1','テスト1',current_timestamp);
insert into CATEGORY values('test2','テスト2',current_timestamp);
insert into CATEGORY values('test3','テスト3',current_timestamp);
insert into CATEGORY values('test4','テスト4',current_timestamp);
insert into CATEGORY values('test5','テスト5',current_timestamp);
insert into CATEGORY values('test6','テスト6',current_timestamp);
insert into CATEGORY values('test7','テスト7',current_timestamp);
insert into CATEGORY values('test8','テスト8',current_timestamp);
insert into CATEGORY values('test9','テスト9',current_timestamp);



drop table TOPIC	;
create table TOPIC(
	TOPICID	DECIMAL(9,0),
	CATEGORYCD	CHAR(5),
	NAME CHAR(20),
	MAIL VARCHAR(200),
	TITLE VARCHAR(100),
	BODY VARCHAR(10000),
	CRTDTTM TIMESTAMP,
	primary key (TOPICID)
);


drop table TOPICRES	;
create table TOPICRES(
	TOPICRESID	DECIMAL(9,0),
	TOPICID	DECIMAL(9,0),
	NAME CHAR(20),
	MAIL VARCHAR(200),
	TITLE VARCHAR(100),
	BODY VARCHAR(10000),
	CRTDTTM TIMESTAMP,
	primary key (TOPICRESID)
);




