Answer the question
In order to leave comments, you need to log in
How to organize a table schema for surveys?
The table needs to store the options for answering the poll and the id of the users who voted for the corresponding answer.
For example,
choice = {
"1-ый вариант ответа: ["1-юзер"],
"2-ой вариант ответа: ["2-юзер", "3-юзер"]
}
CREATE TABLE polls(
id serial primary key,
url text not null,
user_id integer not null,
question text not null,
choice .... ,
FOREIGN KEY (user_id) REFERENCES USERS(id)
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question