今天突然写了一个简单的sql,但是考验sql基础
Auther | CREATE TABLE `auther` (
`AutherID` int(10) NOT NULL AUTO_INCREMENT,
`Authername` char(10) NOT NULL,
`AutherEmail` char(20) NOT NULL,
`AutherPD` varchar(20) NOT NULL,
`introducting` text NOT NULL,
PRIMARY KEY (`AutherID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
Novel | CREATE TABLE `novel` (
`NovelID` int(10) NOT NULL AUTO_INCREMENT,
`NovelName` char(10) NOT NULL,
`Department` char(10) NOT NULL,
`VoteNumber` int(10) NOT NULL,
`Condition` char(4) NOT NULL DEFAULT '连载',
`context` text NOT NULL,
PRIMARY KEY (`NovelID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
CREATE TABLE NA(
ID INT(10) PRIMARY KEY,
Tranfers CHAR(4) NOT NULL,
NovelID INT(10) NOT NULL ,
AutherID INT(10) NOT NULL,
CONSTRAINT `fkq` FOREIGN KEY (`NovelID`) REFERENCES `novel`(`NovelID`),
CONSTRAINT `fkq1` FOREIGN KEY (`AutherID`) REFERENCES `auther`(`AutherID`)
)
里面包含主键,两个外键。