Skip to content
Modelling · drill

The answer is already a table

Return how many submissions answered the plan question with pro. Call the count submissions. The same responses exist in two places; use the one the database can index.

Tables in this database · Submissions
CREATE TABLE submissions (
  id INTEGER PRIMARY KEY,
  received_on DATE NOT NULL,
  data JSONB NOT NULL
)
CREATE TABLE answers (
  submission_id INTEGER NOT NULL,
  question TEXT NOT NULL,
  answer TEXT NOT NULL
)
CREATE INDEX answers_question_idx ON answers (question, answer);

Your query

⌘⏎