【发布时间】:2019-05-02 11:34:28
【问题描述】:
试图创建一个数据库,其中包含一个问题表和一个问题答案表。
如何选择一个问题(来自 poll_question)和该问题的答案(来自 poll_answer)?
CREATE TABLE poll_question(Id_question int primary key not null, question varchar(60));
CREATE TABLE poll_answer(Id_answer int primary key not null, answer varchar(100));
INSERT INTO poll_question(Id_questao, questao)
VALUES(1,"What kind of paper is allowed in tommorows exam?");
INSERT INTO poll_answer(Id_answer,answer)
VALUES(1,"A4 squared sheet");
INSERT INTO poll_answer(Id_answer,answer)
VALUES(2,"A4 lined sheet");
【问题讨论】:
-
提示:
INNER JOIN. -
您需要在“poll_answer”中使用/添加“Id_question”作为参考,作为外键建立表之间的JOIN。
标签: mysql sql mysql-workbench