资源描述:
《MySQL论坛数据库建表实例(张伟)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、CREATETABLEBBSAccount(AccountIDbigintauto_incrementprimarykey,NickNamevarchar(30)NOTNULL,Birthdaydatetime,Passwordvarchar(20),Statechar(2),SEmailvarchar(50));CREATETABLEBBSSector(SectorIDintauto_incrementprimarykey,AccountIDbigintnotnull,SectorNamevarchar(20)notnull,ClickingRateintdefault‘0
2、’,TopicCountbigintdefault‘0’,FOREIGNKEY(AccountID)REFERENCESBBSAccount(AccountID)ONUPDATECASCADEONDELETERESTRICT);CREATETABLEBBSTopic(TopicIDbigintauto_incrementprimarykey,AccountIDbigintnotnull,Titlevarchar(50)notnull,TopicTexttextnotnull,TopicDatetimestampnulldefaultcurrent_timestamp,Repl
3、yCountintnotnull,ClickingRateintdefault‘0’,SectorIDintnotnull,FOREIGNKEY(AccountID)REFERENCESBBSAccount(AccountID)ONUPDATECASCADEONDELETERESTRICT,FOREIGNKEY(SectorID)REFERENCESBBSSector(SectorID)ONUPDATECASCADEONDELETERESTRICT);CREATETABLEBBSReply(ReplyIDbigintauto_incrementprimarykey,Topic
4、IDbigintnotnull,AccountIDbigintnotnull,ReplyTextvarchar(2000)notnull,ReplyDatetimestampnulldefaultcurrent_timestamp,ClickingRateintdefault‘0’,Foreignkey(TopicID)referencesBBSTopic(TopicID)ONUPDATECASCADEONDELETERESTRICT,FOREIGNKEY(AccountID)REFERENCESBBSAccount(AccountID)ONUPDATECASCADEONDE
5、LETERESTRICT);package model;publicclassBBSAccountimplements java.io.Serializable {privateIntegerAccountID;privateStringNickName;privateStringBirthday;//timestamp对应的是什么类型?privateStringPassword;privateStringState;privateStringSEmail;publicBBSAccount(){}publicBBSAccount(IntegerAccountID,String
6、NickName,StringBirthday,StringPassword,StringState,StringSEmail){this.AccountID=AccountID;this.NickName=NickName;this.Birthday=Birthday;this.Password=Password;this.State=State;this.SEmail=SEmail;}publicStringgetAccountID(IntegerAccountID){returnAccountID;}publicvoidsetAccountID(IntegerAccou
7、ntID){this.AccountID=AccountID;}publicStringgetNickName(StringNickName){returnNickName;}publicvoidsetNickName(StringNickName){this.NickName=NickName;}publicStringgetBirthday(StringBirthday){returnBirthday;}publicvoidsetPassword(StringPassword){this.Passw