lianghsun/bird-text2sql-bench huggingface dataset:
### Database Schema
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 "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)
)

### Question
From 2016 to 2019, how many users each year were asked the question 13?

### Hint
From 2016 to 2019 refer to SurveyID 2016 BETWEEN 2019; Question 13 refer to QuestionID

### SQL
SELECT SurveyID, COUNT(UserID) FROM Answer WHERE QuestionID = 13 AND SurveyID BETWEEN 2016 AND 2019 GROUP BY SurveyID
### Database Schema
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 "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)
)

### Question
How many users, between the age 27 to 35, were surveyed in 2018?

### Hint
Age 27 to 35 refer to AnswerText 27 BETWEEN 35 where questionid = 1; 2018 refer to SurveyID



### SQL
SELECT T1.UserID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID = 2018 AND T2.questionid = 1 AND T1.AnswerText BETWEEN '27' AND '35'
### Database Schema
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 "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)
)

### Question
In 2019, how many users in the United States have a family history of mental illness?

### Hint
2019 refer to SurveyID; Users in the United States refers to AnswerText = 'United States' where questionid = 3; have a family history of mental illness refers to AnswerText = 'Yes' where questionid = 6

### SQL
SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN ( SELECT T2.questionid FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID = 2019 AND T2.questionid = 6 AND T1.AnswerText LIKE 'Yes' ) AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID = 2019 AND T2.questionid = 3 AND T1.AnswerText LIKE 'United States'
### Database Schema
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 "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)
)

### Question
Betweeen 2016 to 2019, which year recorded the highest number of people with mental illness?

### Hint
Between 2016 to 2019 refer to SurveyID 2016 BETWEEN 2019; People with mental illness refers to AnswerText = 'Yes' where questionid = 34

### SQL
SELECT T1.SurveyID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID BETWEEN 2016 AND 2019 AND T2.questionid = 34 AND T1.AnswerText LIKE 'Yes' GROUP BY T1.SurveyID ORDER BY COUNT(T1.UserID) DESC LIMIT 1
### Database Schema
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 "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)
)

### Question
How many female users were surveyed in the mental health survey for 2017 in the state of Nebraska?

### Hint
AnswerText = 'Yes' where questiontext = 'Do you have a family history of mental illness?'; AnswerText = 'Female' where questionid = 2; AnswerText = 'Nebraska' where questionid = 4

### SQL
SELECT COUNT(*) FROM ( SELECT T2.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID INNER JOIN Survey AS T3 ON T2.SurveyID = T3.SurveyID WHERE T3.Description = 'mental health survey for 2017' AND T1.questionid = 2 AND T2.AnswerText = 'Female' UNION SELECT T2.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID INNER JOIN Survey AS T3 ON T2.SurveyID = T3.SurveyID WHERE T1.questionid = 4 AND T2.AnswerText = 'Nebraska' AND T3.Description = 'mental health survey for 2017' )
### Database Schema
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 "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)
)

### Question
How many users believed that their productivity is ever affected by a mental health issue overall?

### Hint
Users who believed that their productivity is affected by a mental health issues overall refers to AnswerText = 'Yes' where questionid = 54

### SQL
SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 54 AND T1.AnswerText LIKE 'Yes'
### Database Schema
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 "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)
)

### Question
What are the ages of the oldest and youngest user that were surveyed? Indicate their user id.

### Hint
Oldest user refer to MAX(AnswerText) where questionid = 1; Youngest user refer to MIN(AnswerText) where questionid = 1


### SQL
SELECT MAX(T1.AnswerText), MIN(T1.AnswerText) , ( SELECT T1.UserID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 1 ORDER BY T1.AnswerText LIMIT 1 ) AS "youngest id" FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 1
### Database Schema
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 "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)
)

### Question
Which country have the least number of users being surveyed? Indicate the name of the country. If there are multiple countries having the same number of users, indicate all of their names.

### Hint
Country with least number of users being surveyed refers to MIN(COUNT(AnswerText)) where questionid = 3

### SQL
SELECT T1.AnswerText FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 3 GROUP BY T1.AnswerText ORDER BY COUNT(T1.UserID) DESC LIMIT 1
### Database Schema
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 "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)
)

### Question
What is the average age of the survey respondents in the United States?

### Hint
Average age refer to AVG(AnswerText) where questionid = 1; respondents in the United States refers to AnswerText = 'United States' where questionid = 3

### SQL
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
### Database Schema
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 "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)
)

### Question
What is the percentage of the the users who would bring up a mental health issue with a potential employer in an interview?

### Hint
Percentage = DIVIDE(SUM(AnswerText = 'Yes' Or AnswerText = 'Maybe'), COUNT(QuestionID = 12))* 100

### SQL
SELECT CAST(SUM(CASE  WHEN T1.AnswerText LIKE 'Yes' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 12
### Database Schema
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 "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)
)

### Question
How many questions in 2014's survey had more than 200 answers?

### Hint
2014 refer to SurveyID; COUNT(QuestionID) where COUNT(AnswerText) > 200

### SQL
SELECT COUNT(QuestionID) FROM Answer WHERE SurveyID LIKE 2014 GROUP BY QuestionID ORDER BY COUNT(QuestionID) > 200 LIMIT 1
### Database Schema
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 "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)
)

### Question
What is the oldest age of the users in 2014's survey?

### Hint
what is your age? refer to QuestionText; 2014 refer to SurveyID; oldest age refers to MAX(AnswerText)



### SQL
SELECT T2.AnswerText FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'What is your age?' AND T2.SurveyID = 2014 ORDER BY T2.AnswerText DESC LIMIT 1
### Database Schema
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 "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)
)

### Question
How many users answered "No" to the question "Would you bring up a mental health issue with a potential employer in an interview?" in 2014's survey?

### Hint
2014 refer to SurveyID; Answered No refer to AnswerText = 'No'; Question refer to questiontext



### SQL
SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'Would you bring up a mental health issue with a potential employer in an interview?' AND T2.SurveyID = 2014 AND T2.AnswerText LIKE 'NO'
### Database Schema
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 "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)
)

### Question
Please list the IDs of the users who answered "Yes" to the question "Do you think that discussing a physical health issue with your employer would have negative consequences?" in 2014's survey.

### Hint
2014 refer to SurveyID; Question refer to questiontext; yes refer to AnswerText = 'Yes'



### SQL
SELECT T2.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'Do you think that discussing a physical health issue with your employer would have negative consequences?' AND T2.AnswerText LIKE 'Yes' AND T2.SurveyID = 2014
### Database Schema
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 "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)
)

### Question
How many users participated in the mental health survey for 2014?

### Hint
mental health survey for 2014 refers to SurveyID = 2014

### SQL
SELECT COUNT(DISTINCT T1.UserID) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2014'
### Database Schema
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 "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)
)

### Question
Please list all the answers to the question "Any additional notes or comments" that are not null in 2014's survey.

### Hint
question refers to questiontext; the answers that are not null refers to AnswerText ! = -1


### SQL
SELECT T2.AnswerText FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'Any additional notes or comments' AND T2.SurveyID = 2014 AND T2.AnswerText <> -1
### Database Schema
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 "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)
)

### Question
Please list all the common questions in 2014's survey and 2016's survey.

### Hint
question refers to questiontext; all the common questions in 2014's survey and 2016's survey refers to QuestionID(SurveyID(2014)) = QuestionID(SurveyID(2016))


### SQL
SELECT T1.questiontext FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID IN (2014, 2016) GROUP BY T1.questiontext
### Database Schema
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 "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)
)

### Question
How many users lived in Canada according to 2018's survey?

### Hint
lived in Canada refers to AnswerText(QuestionID(3)) = 'Canada'

### SQL
SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2018 AND T1.questiontext = 'What country do you live in?' AND T2.AnswerText = 'Canada'
### Database Schema
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 "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)
)

### Question
Please list all the questions in the mental health survey for 2014.

### Hint
mental health survey for 2014 refers to SurveyID = 2014

### SQL
SELECT T2.questiontext FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid INNER JOIN Survey AS T3 ON T1.SurveyID = T3.SurveyID WHERE T3.Description LIKE 'mental health survey for 2014' GROUP BY T2.questiontext
### Database Schema
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 "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)
)

### Question
According to 2016's survey, what is the number of users with a mental health disorder in the past?

### Hint
users with a mental health disorder in the past refers to AnswerText(QuestionID(32)) = 'Yes'

### SQL
SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2016 AND T1.questiontext LIKE 'Have you had a mental health disorder in the past?' AND T2.AnswerText = 'Yes'
### Database Schema
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 "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)
)

### Question
How many users answered "Yes" to the question "Have you had a mental health disorder in the past?" in 3 consecutive years starting from 2016?

### Hint
question refers to questiontext; answered 'Yes' to question refers to AnswerText = 'Yes'; 3 consecutive years starting from 2016 refers to SurveyID = 2016 and SurveyID = 2017 and SurveyID = 2018

### SQL
SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID IN (2016, 2017, 2018) AND T1.questiontext LIKE 'Have you had a mental health disorder in the past?' AND T2.AnswerText = 'Yes'
### Database Schema
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 "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)
)

### Question
What is the average result of the question "What is your age?" in 2014's survey?

### Hint
average result refers to avg(AnswerText(SurveyID = 2014& QuestionID = 1))

### SQL
SELECT CAST(SUM(T2.AnswerText) AS REAL) / COUNT(T2.UserID) AS "avg" FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2014 AND T1.questiontext LIKE 'What is your age?'