Java第九篇:新聞發佈系統數據庫創建代碼

    最近在學習新聞發佈系統,本想在網上找相關代碼的,但沒找到合適的,所以自己就寫了一下,想到肯定有些小夥伴會用到,所以阿偉把代碼放在這裏供大家使用。新聞發佈系統主要分爲兩大模塊:用戶管理和新聞管理
    首先我們來看用戶管理模塊數據庫創建代碼:
    創建用戶表(user):

create table user(
			id int(11) not null primary key auto_increment,
			username varchar(20) not null,
			password varchar(18) not null,
			sex varchar(1) not null  comment "取值0:男,1:女",
			profession varchar(1)  comment "取值0:學生,1:老師,2:工人",
			favourite varchar(255)  comment "取值0:電腦網絡,1:影視娛樂,2:棋牌娛樂",
			note varchar(255),
			type varchar(1)  comment "取值0:普通用戶,1:管理員,默認爲0"
);

    創建新聞表(news):

create table news(id int(11) not null primary key auto_increment  comment "自動增長",
	title varchar(50) not null,
	content text,
	userid int(11) not null  comment "引用用戶表主鍵",
	pubtime datetime not null,foreign key(userid) references user(id));

點個贊,加個關注唄!嘿嘿!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章