What is the average age of the survey respondents in the United States?
Average age refer to AVG(AnswerText) where questionid = 1; respondents in the United States refers to AnswerText = 'United States' where questionid = 3
SELECT CAST(SUM(T1.AnswerText) AS REAL) / COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN ( SELECT T1.UserID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 3 AND T1.AnswerText = 'United States' ) AS T2 ON T1.UserID = T2.UserID INNER JOIN Question AS T3 ON T1.QuestionID = T3.questionid WHERE T3.questionid = 1
CREATE TABLE Question
(
    questiontext TEXT,
    questionid   INTEGER
        constraint Question_pk
            primary key
);
CREATE TABLE Survey
(
    SurveyID    INTEGER
        constraint Survey_pk
            primary key,
    Description TEXT
);
CREATE TABLE IF NOT EXISTS "Answer"
(
    AnswerText TEXT,
    SurveyID   INTEGER
        constraint Answer_Survey_SurveyID_fk
            references Survey,
    UserID     INTEGER,
    QuestionID INTEGER
        constraint Answer_Question_questionid_fk
            references Question,
    constraint Answer_pk
        primary key (UserID, QuestionID)
);
