lianghsun/bird-text2sql-bench huggingface dataset:
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
For the pairs of genes with one having 8 chromosomes and the other having 6 chromosomes, what is the highest expression correlation score?

### SQL
SELECT T2.Expression_Corr FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Chromosome = 6 OR T1.Chromosome = 8 ORDER BY T2.Expression_Corr DESC LIMIT 1
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
Please list the motif of the genes that are located in the cytoplasm and have 7 chromosomes.

### SQL
SELECT T2.GeneID1, T2.GeneID2 FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization = 'cytoplasm' AND T1.Chromosome = 7
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
For the non-essential genes whose functions are transcription, how many of them are not located in the cytoplasm?

### SQL
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization != 'cytoplasm' AND T1.Function = 'TRANSCRIPTION' AND T1.Essential = 'NON-Essential'
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
How many pairs of positively correlated genes are both non-essential?

### Hint
If Expression_Corr > 0, it means the expression correlation is positive

### SQL
SELECT COUNT(T2.GeneID2) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr > 0 AND T1.Essential = 'Non-Essential'
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
If a pair of genes is positively correlated, what is the possibility of it being composed of two genes both with over 10 chromosomes?

### Hint
Positively correlated means Expression_Corr > 0; Possibility = count(the pairs of genes with both chromosomes over 20) / count(pairs of genes that are positively correlated)

### SQL
SELECT CAST(SUM(IIF(T1.Chromosome > 10 AND T3.Chromosome > 10, 1, 0)) AS REAL) * 100 / COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 INNER JOIN Genes AS T3 ON T3.GeneID = T2.GeneID2 WHERE T2.Expression_Corr > 0
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
For the pairs of genes both from the class ATPases, what is the average expression correlation score?

### SQL
SELECT AVG(T2.Expression_Corr) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Class = 'ATPases'
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
Lists all genes by identifier number located in the cytoplasm and whose function is metabolism.

### SQL
SELECT DISTINCT GeneID FROM Genes WHERE Localization = 'cytoplasm' AND Function = 'METABOLISM'
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
How many different genes do we have if we add those located in the plasma and in the nucleus?

### SQL
SELECT COUNT(GeneID) FROM Classification WHERE Localization IN ('plasma', 'nucleus')
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
What kind of expression correlation occurs in physical type interacting gene pairs and what percentage of these are negatively correlated?

### Hint
If the Expression_Corr value is negative then it's negatively correlated. Percentage of Negative Correlation = count(negative Expression_Corr physical type) / count(Expression_Corr physical type) * 100%

### SQL
SELECT Expression_Corr FROM Interactions WHERE Type = 'Physical' UNION ALL SELECT CAST(SUM(Expression_Corr < 0) AS REAL) * 100 / COUNT(*) FROM Interactions WHERE Type = 'Physical'
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
What percentage of genes located in the cytoskeleton are of unknown class? And of these, how many are not conditional phenotypes?

### Hint
Percentage = count(genes located in the cytoskeleton unknown class) / count(genes located in the cytoskeleton) * 100%

### SQL
SELECT SUM(Localization = 'cytoskeleton' AND Phenotype = 'Conditional phenotypes') , CAST(SUM(Localization = 'cytoskeleton') AS REAL) * 100 / COUNT(GeneID) FROM Genes;
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
What type of interactions occurs in genes whose function is cellular transport and transport medicine and are classified as non-essential?

### SQL
SELECT T2.Type FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Function = 'TRANSCRIPTION' AND T1.Essential = 'Non-Essential'
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
List all genes whose interaction is with genes located in the nucleus in which it is positively correlated.

### Hint
If the Expression_Corr value is positive then it's positively correlated

### SQL
SELECT T1.GeneID FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr > 0 AND T1.Localization = 'nucleus'
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
Taking all the essential genes of the transcription factors class located in the nucleus as a reference, how many of them carry out a genetic-type interaction with another gene? List them.

### SQL
SELECT T2.GeneID1 FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization = 'nucleus' AND T1.Class = 'Transcription factors' AND T1.Essential = 'Essential' AND T2.Expression_Corr != 0
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
Of all the nonessential genes that are not of the motorprotein class and whose phenotype is cell cycle defects, how many do not have a physical type of interaction?

### SQL
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Type != 'Physical' AND T1.Phenotype = 'Cell cycle defects' AND T1.Class != 'Motorproteins' AND T1.Essential = 'Non-Essential'
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
Of the genes whose phenotype and motif are nucleic acid metabolism defects, PS00107, what percentage perform positive interaction with another gene?

### Hint
Percentage of no interaction = [count(nucleic acid metabolism, PS00107, no interaction) / count(nucleic acid metabolism, PS00107) * 100%

### SQL
SELECT CAST(SUM(IIF(T2.Expression_Corr > 0, 1, 0)) AS REAL) * 100 / COUNT(T2.GeneID1) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Phenotype = 'Nucleic acid metabolism defects' AND T1.Motif = 'PS00107'
### Database Schema
CREATE TABLE Classification
(
    GeneID       TEXT   not null
        primary key,
    Localization TEXT not null
)

CREATE TABLE Genes
(
    GeneID       TEXT   not null,
    Essential    TEXT not null,
    Class        TEXT not null,
    Complex      TEXT null,
    Phenotype    TEXT not null,
    Motif        TEXT not null,
    Chromosome   INTEGER          not null,
    Function     TEXT not null,
    Localization TEXT not null,
    foreign key (GeneID) references Classification (GeneID)
            on update cascade on delete cascade
)

CREATE TABLE Interactions
(
    GeneID1         TEXT     not null,
    GeneID2         TEXT      not null,
    Type            TEXT    not null,
    Expression_Corr REAL not null,
    primary key (GeneID1, GeneID2),
    foreign key (GeneID1) references Classification (GeneID)
            on update cascade on delete cascade,
    foreign key (GeneID2) references Classification (GeneID)
            on update cascade on delete cascade
)

### Question
Which negatively correlated, genetically interacting genes are non-essential? What percentage do they represent with respect to those that are essential?

### Hint
If the Expression_Corr value is negative then it's negatively correlated; Percentage of Essensity = [count(negatively correlated, genetical interaction, non-essential) / count(negatively correlated, genetical interaction, non-essential+negatively correlated, genetical interaction, essential)] * 100%

### SQL
SELECT CAST(COUNT(T1.GeneID) AS REAL) * 100 / ( SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 ) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 AND T1.Essential = 'Non-Essential'
### Database Schema
CREATE TABLE "playstore"
(
    App              TEXT,
    Category         TEXT,
    Rating           REAL,
    Reviews          INTEGER,
    Size             TEXT,
    Installs         TEXT,
    Type             TEXT,
    Price            TEXT,
    "Content Rating" TEXT,
    Genres           TEXT
)

CREATE TABLE "user_reviews"
(
    App                    TEXT
        references "playstore" (App),
    Translated_Review      TEXT,
    Sentiment              TEXT,
    Sentiment_Polarity     TEXT,
    Sentiment_Subjectivity TEXT
)

### Question
How many apps were last updated in January of 2018? Please write one translated review with positive sentiment for each app, if there's any.

### Hint
updated in January of 2018 refers to Last Updated BETWEEN 'January 1, 2018' and 'January 31, 2018';

### SQL
SELECT DISTINCT Translated_Review FROM user_reviews WHERE App IN ( SELECT App FROM playstore WHERE `Last Updated` BETWEEN 'January 1, 2018' AND 'January 31, 2018' ) AND Sentiment = 'Positive'