问题
通常是选择什么联接,还有外键通常起的是什么作用
实际
我要创建一个分类表,和一个文章表,想在文章里有一个分类id,要搞个外键吗,还是像上面哪样内外连接
let category =
`create table if not exists category(
id INT NOT NULL AUTO_INCREMENT,
categoryName varchar(100) not null,
PRIMARY KEY (id)
);`
let article =
`create table if not exists article(
id INT NOT NULL AUTO_INCREMENT,
articleName varchar(100) not null,
c_id INT NOT NULL,
PRIMARY KEY (id)
);`