lianghsun/bird-text2sql-bench huggingface dataset:
### Database Schema
CREATE TABLE `businesses` (
  `business_id` INTEGER NOT NULL,
  `name` TEXT NOT NULL,
  `address` TEXT DEFAULT NULL,
  `city` TEXT DEFAULT NULL,
  `postal_code` TEXT DEFAULT NULL,
  `latitude` REAL DEFAULT NULL,
  `longitude` REAL DEFAULT NULL,
  `phone_number` INTEGER DEFAULT NULL,
  `tax_code` TEXT DEFAULT NULL,
  `business_certificate` INTEGER NOT NULL,
  `application_date` DATE DEFAULT NULL,
  `owner_name` TEXT NOT NULL,
  `owner_address` TEXT DEFAULT NULL,
  `owner_city` TEXT DEFAULT NULL,
  `owner_state` TEXT DEFAULT NULL,
  `owner_zip` TEXT DEFAULT NULL,
  PRIMARY KEY (`business_id`)
)

CREATE TABLE `inspections` (
  `business_id` INTEGER NOT NULL,
  `score` INTEGER DEFAULT NULL,
  `date` DATE NOT NULL,
  `type` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

CREATE TABLE `violations` (
  `business_id` INTEGER NOT NULL,
  `date` DATE NOT NULL,
  `violation_type_id` TEXT NOT NULL,
  `risk_category` TEXT NOT NULL,
  `description` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

### Question
List owner's name of businesses with a 100 score.

### Hint
owner's name of businesses refers to owner_name;

### SQL
SELECT DISTINCT T2.owner_name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.score = 100
### Database Schema
CREATE TABLE `businesses` (
  `business_id` INTEGER NOT NULL,
  `name` TEXT NOT NULL,
  `address` TEXT DEFAULT NULL,
  `city` TEXT DEFAULT NULL,
  `postal_code` TEXT DEFAULT NULL,
  `latitude` REAL DEFAULT NULL,
  `longitude` REAL DEFAULT NULL,
  `phone_number` INTEGER DEFAULT NULL,
  `tax_code` TEXT DEFAULT NULL,
  `business_certificate` INTEGER NOT NULL,
  `application_date` DATE DEFAULT NULL,
  `owner_name` TEXT NOT NULL,
  `owner_address` TEXT DEFAULT NULL,
  `owner_city` TEXT DEFAULT NULL,
  `owner_state` TEXT DEFAULT NULL,
  `owner_zip` TEXT DEFAULT NULL,
  PRIMARY KEY (`business_id`)
)

CREATE TABLE `inspections` (
  `business_id` INTEGER NOT NULL,
  `score` INTEGER DEFAULT NULL,
  `date` DATE NOT NULL,
  `type` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

CREATE TABLE `violations` (
  `business_id` INTEGER NOT NULL,
  `date` DATE NOT NULL,
  `violation_type_id` TEXT NOT NULL,
  `risk_category` TEXT NOT NULL,
  `description` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

### Question
Among the businesses within the postal code 94117, what is total number of businesses with a high risk category?

### Hint
businesses with a high risk category refer to business_id where risk_category = 'High Risk';

### SQL
SELECT COUNT(DISTINCT T2.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.postal_code = 94117 AND T1.risk_category = 'High Risk'
### Database Schema
CREATE TABLE `businesses` (
  `business_id` INTEGER NOT NULL,
  `name` TEXT NOT NULL,
  `address` TEXT DEFAULT NULL,
  `city` TEXT DEFAULT NULL,
  `postal_code` TEXT DEFAULT NULL,
  `latitude` REAL DEFAULT NULL,
  `longitude` REAL DEFAULT NULL,
  `phone_number` INTEGER DEFAULT NULL,
  `tax_code` TEXT DEFAULT NULL,
  `business_certificate` INTEGER NOT NULL,
  `application_date` DATE DEFAULT NULL,
  `owner_name` TEXT NOT NULL,
  `owner_address` TEXT DEFAULT NULL,
  `owner_city` TEXT DEFAULT NULL,
  `owner_state` TEXT DEFAULT NULL,
  `owner_zip` TEXT DEFAULT NULL,
  PRIMARY KEY (`business_id`)
)

CREATE TABLE `inspections` (
  `business_id` INTEGER NOT NULL,
  `score` INTEGER DEFAULT NULL,
  `date` DATE NOT NULL,
  `type` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

CREATE TABLE `violations` (
  `business_id` INTEGER NOT NULL,
  `date` DATE NOT NULL,
  `violation_type_id` TEXT NOT NULL,
  `risk_category` TEXT NOT NULL,
  `description` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

### Question
Among the businesses with score that ranges from 70 to 80, list their violation type ID and risk category.

### Hint
businesses with score that ranges from 70 to 80 refer to business_id where score between 80 and 90;

### SQL
SELECT DISTINCT T1.violation_type_id, T1.risk_category FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id INNER JOIN inspections AS T3 ON T2.business_id = T3.business_id WHERE T3.score BETWEEN 70 AND 80
### Database Schema
CREATE TABLE `businesses` (
  `business_id` INTEGER NOT NULL,
  `name` TEXT NOT NULL,
  `address` TEXT DEFAULT NULL,
  `city` TEXT DEFAULT NULL,
  `postal_code` TEXT DEFAULT NULL,
  `latitude` REAL DEFAULT NULL,
  `longitude` REAL DEFAULT NULL,
  `phone_number` INTEGER DEFAULT NULL,
  `tax_code` TEXT DEFAULT NULL,
  `business_certificate` INTEGER NOT NULL,
  `application_date` DATE DEFAULT NULL,
  `owner_name` TEXT NOT NULL,
  `owner_address` TEXT DEFAULT NULL,
  `owner_city` TEXT DEFAULT NULL,
  `owner_state` TEXT DEFAULT NULL,
  `owner_zip` TEXT DEFAULT NULL,
  PRIMARY KEY (`business_id`)
)

CREATE TABLE `inspections` (
  `business_id` INTEGER NOT NULL,
  `score` INTEGER DEFAULT NULL,
  `date` DATE NOT NULL,
  `type` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

CREATE TABLE `violations` (
  `business_id` INTEGER NOT NULL,
  `date` DATE NOT NULL,
  `violation_type_id` TEXT NOT NULL,
  `risk_category` TEXT NOT NULL,
  `description` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

### Question
List the tax code and inspection type of the business named "Rue Lepic".

### Hint
"Rue Lepic" is the name of the business;

### SQL
SELECT DISTINCT T3.tax_code, T2.type FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id INNER JOIN businesses AS T3 ON T2.business_id = T3.business_id WHERE T3.name = 'Rue Lepic'
### Database Schema
CREATE TABLE `businesses` (
  `business_id` INTEGER NOT NULL,
  `name` TEXT NOT NULL,
  `address` TEXT DEFAULT NULL,
  `city` TEXT DEFAULT NULL,
  `postal_code` TEXT DEFAULT NULL,
  `latitude` REAL DEFAULT NULL,
  `longitude` REAL DEFAULT NULL,
  `phone_number` INTEGER DEFAULT NULL,
  `tax_code` TEXT DEFAULT NULL,
  `business_certificate` INTEGER NOT NULL,
  `application_date` DATE DEFAULT NULL,
  `owner_name` TEXT NOT NULL,
  `owner_address` TEXT DEFAULT NULL,
  `owner_city` TEXT DEFAULT NULL,
  `owner_state` TEXT DEFAULT NULL,
  `owner_zip` TEXT DEFAULT NULL,
  PRIMARY KEY (`business_id`)
)

CREATE TABLE `inspections` (
  `business_id` INTEGER NOT NULL,
  `score` INTEGER DEFAULT NULL,
  `date` DATE NOT NULL,
  `type` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

CREATE TABLE `violations` (
  `business_id` INTEGER NOT NULL,
  `date` DATE NOT NULL,
  `violation_type_id` TEXT NOT NULL,
  `risk_category` TEXT NOT NULL,
  `description` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

### Question
In businesses that violates 103157 on May 27, 2016 , what is the name of the business that has an unscheduled inspection?

### Hint
businesses that violates 103157 refer to business_id where violation_type_id = 103157; date = '2016-05-27'; unscheduled inspection refers to type = 'Routine - Unscheduled';

### SQL
SELECT DISTINCT T3.name FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id INNER JOIN businesses AS T3 ON T2.business_id = T3.business_id WHERE T1.`date` = '2016-05-27' AND T1.violation_type_id = 103157 AND T2.type = 'Routine - Unscheduled'
### Database Schema
CREATE TABLE `businesses` (
  `business_id` INTEGER NOT NULL,
  `name` TEXT NOT NULL,
  `address` TEXT DEFAULT NULL,
  `city` TEXT DEFAULT NULL,
  `postal_code` TEXT DEFAULT NULL,
  `latitude` REAL DEFAULT NULL,
  `longitude` REAL DEFAULT NULL,
  `phone_number` INTEGER DEFAULT NULL,
  `tax_code` TEXT DEFAULT NULL,
  `business_certificate` INTEGER NOT NULL,
  `application_date` DATE DEFAULT NULL,
  `owner_name` TEXT NOT NULL,
  `owner_address` TEXT DEFAULT NULL,
  `owner_city` TEXT DEFAULT NULL,
  `owner_state` TEXT DEFAULT NULL,
  `owner_zip` TEXT DEFAULT NULL,
  PRIMARY KEY (`business_id`)
)

CREATE TABLE `inspections` (
  `business_id` INTEGER NOT NULL,
  `score` INTEGER DEFAULT NULL,
  `date` DATE NOT NULL,
  `type` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

CREATE TABLE `violations` (
  `business_id` INTEGER NOT NULL,
  `date` DATE NOT NULL,
  `violation_type_id` TEXT NOT NULL,
  `risk_category` TEXT NOT NULL,
  `description` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

### Question
Who is the owner of the business that has a high risk violation of 103109 and described as unclean or unsanitary food contact surfaces?

### Hint
owner refers to owner_name; high risk violation of 103109 and described as unclean or unsanitary food contact surfaces refers to risk_category = 'High Risk' where violation_type_id = 103109 and description = 'Unclean or unsanitary food contact surfaces';

### SQL
SELECT DISTINCT T2.owner_name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'High Risk' AND T1.violation_type_id = 103109 AND T1.description = 'Unclean or unsanitary food contact surfaces'
### Database Schema
CREATE TABLE `businesses` (
  `business_id` INTEGER NOT NULL,
  `name` TEXT NOT NULL,
  `address` TEXT DEFAULT NULL,
  `city` TEXT DEFAULT NULL,
  `postal_code` TEXT DEFAULT NULL,
  `latitude` REAL DEFAULT NULL,
  `longitude` REAL DEFAULT NULL,
  `phone_number` INTEGER DEFAULT NULL,
  `tax_code` TEXT DEFAULT NULL,
  `business_certificate` INTEGER NOT NULL,
  `application_date` DATE DEFAULT NULL,
  `owner_name` TEXT NOT NULL,
  `owner_address` TEXT DEFAULT NULL,
  `owner_city` TEXT DEFAULT NULL,
  `owner_state` TEXT DEFAULT NULL,
  `owner_zip` TEXT DEFAULT NULL,
  PRIMARY KEY (`business_id`)
)

CREATE TABLE `inspections` (
  `business_id` INTEGER NOT NULL,
  `score` INTEGER DEFAULT NULL,
  `date` DATE NOT NULL,
  `type` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

CREATE TABLE `violations` (
  `business_id` INTEGER NOT NULL,
  `date` DATE NOT NULL,
  `violation_type_id` TEXT NOT NULL,
  `risk_category` TEXT NOT NULL,
  `description` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

### Question
Among the owners from Cameron Park, what is the business name of the business with a score of 100?

### Hint
Cameron Park is a name of city;

### SQL
SELECT DISTINCT T2.name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.owner_city = 'Cameron Park' AND T1.score = 100
### Database Schema
CREATE TABLE `businesses` (
  `business_id` INTEGER NOT NULL,
  `name` TEXT NOT NULL,
  `address` TEXT DEFAULT NULL,
  `city` TEXT DEFAULT NULL,
  `postal_code` TEXT DEFAULT NULL,
  `latitude` REAL DEFAULT NULL,
  `longitude` REAL DEFAULT NULL,
  `phone_number` INTEGER DEFAULT NULL,
  `tax_code` TEXT DEFAULT NULL,
  `business_certificate` INTEGER NOT NULL,
  `application_date` DATE DEFAULT NULL,
  `owner_name` TEXT NOT NULL,
  `owner_address` TEXT DEFAULT NULL,
  `owner_city` TEXT DEFAULT NULL,
  `owner_state` TEXT DEFAULT NULL,
  `owner_zip` TEXT DEFAULT NULL,
  PRIMARY KEY (`business_id`)
)

CREATE TABLE `inspections` (
  `business_id` INTEGER NOT NULL,
  `score` INTEGER DEFAULT NULL,
  `date` DATE NOT NULL,
  `type` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

CREATE TABLE `violations` (
  `business_id` INTEGER NOT NULL,
  `date` DATE NOT NULL,
  `violation_type_id` TEXT NOT NULL,
  `risk_category` TEXT NOT NULL,
  `description` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

### Question
List the violation type ID of business with business ID from 30 to 50 and located at 747 IRVING St, San Francisco.

### Hint
business ID from 30 to 50 refers to business_id between 30 and 50; address = '747 IRVING St'; city = 'San Francisco';

### SQL
SELECT DISTINCT T1.violation_type_id FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.business_id BETWEEN 30 AND 50 AND T2.address = '747 IRVING St' AND T2.city = 'San Francisco'
### Database Schema
CREATE TABLE `businesses` (
  `business_id` INTEGER NOT NULL,
  `name` TEXT NOT NULL,
  `address` TEXT DEFAULT NULL,
  `city` TEXT DEFAULT NULL,
  `postal_code` TEXT DEFAULT NULL,
  `latitude` REAL DEFAULT NULL,
  `longitude` REAL DEFAULT NULL,
  `phone_number` INTEGER DEFAULT NULL,
  `tax_code` TEXT DEFAULT NULL,
  `business_certificate` INTEGER NOT NULL,
  `application_date` DATE DEFAULT NULL,
  `owner_name` TEXT NOT NULL,
  `owner_address` TEXT DEFAULT NULL,
  `owner_city` TEXT DEFAULT NULL,
  `owner_state` TEXT DEFAULT NULL,
  `owner_zip` TEXT DEFAULT NULL,
  PRIMARY KEY (`business_id`)
)

CREATE TABLE `inspections` (
  `business_id` INTEGER NOT NULL,
  `score` INTEGER DEFAULT NULL,
  `date` DATE NOT NULL,
  `type` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

CREATE TABLE `violations` (
  `business_id` INTEGER NOT NULL,
  `date` DATE NOT NULL,
  `violation_type_id` TEXT NOT NULL,
  `risk_category` TEXT NOT NULL,
  `description` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

### Question
What is the owner's name of the of the business that violates 103156 on June 12, 2014?

### Hint
business that violates 103156 on June 12, 2014 refers to business_id where violation_type_id = 103156 and date = '2014-06-12';

### SQL
SELECT DISTINCT T2.owner_name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.violation_type_id = 103156 AND T1.`date` = '2014-06-12'
### Database Schema
CREATE TABLE `businesses` (
  `business_id` INTEGER NOT NULL,
  `name` TEXT NOT NULL,
  `address` TEXT DEFAULT NULL,
  `city` TEXT DEFAULT NULL,
  `postal_code` TEXT DEFAULT NULL,
  `latitude` REAL DEFAULT NULL,
  `longitude` REAL DEFAULT NULL,
  `phone_number` INTEGER DEFAULT NULL,
  `tax_code` TEXT DEFAULT NULL,
  `business_certificate` INTEGER NOT NULL,
  `application_date` DATE DEFAULT NULL,
  `owner_name` TEXT NOT NULL,
  `owner_address` TEXT DEFAULT NULL,
  `owner_city` TEXT DEFAULT NULL,
  `owner_state` TEXT DEFAULT NULL,
  `owner_zip` TEXT DEFAULT NULL,
  PRIMARY KEY (`business_id`)
)

CREATE TABLE `inspections` (
  `business_id` INTEGER NOT NULL,
  `score` INTEGER DEFAULT NULL,
  `date` DATE NOT NULL,
  `type` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

CREATE TABLE `violations` (
  `business_id` INTEGER NOT NULL,
  `date` DATE NOT NULL,
  `violation_type_id` TEXT NOT NULL,
  `risk_category` TEXT NOT NULL,
  `description` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

### Question
In businesses with an owner address 500 California St, 2nd Floor of Silicon Valley, list the type of inspection of the business with the highest score.

### Hint
the highest score MAX(score); Silicon Valley is located in 'SAN FRANCISCO';

### SQL
SELECT T1.type FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.owner_address = '500 California St, 2nd Floor' AND T2.owner_city = 'SAN FRANCISCO' ORDER BY T1.score DESC LIMIT 1
### Database Schema
CREATE TABLE `businesses` (
  `business_id` INTEGER NOT NULL,
  `name` TEXT NOT NULL,
  `address` TEXT DEFAULT NULL,
  `city` TEXT DEFAULT NULL,
  `postal_code` TEXT DEFAULT NULL,
  `latitude` REAL DEFAULT NULL,
  `longitude` REAL DEFAULT NULL,
  `phone_number` INTEGER DEFAULT NULL,
  `tax_code` TEXT DEFAULT NULL,
  `business_certificate` INTEGER NOT NULL,
  `application_date` DATE DEFAULT NULL,
  `owner_name` TEXT NOT NULL,
  `owner_address` TEXT DEFAULT NULL,
  `owner_city` TEXT DEFAULT NULL,
  `owner_state` TEXT DEFAULT NULL,
  `owner_zip` TEXT DEFAULT NULL,
  PRIMARY KEY (`business_id`)
)

CREATE TABLE `inspections` (
  `business_id` INTEGER NOT NULL,
  `score` INTEGER DEFAULT NULL,
  `date` DATE NOT NULL,
  `type` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

CREATE TABLE `violations` (
  `business_id` INTEGER NOT NULL,
  `date` DATE NOT NULL,
  `violation_type_id` TEXT NOT NULL,
  `risk_category` TEXT NOT NULL,
  `description` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

### Question
Among the violations in 2016, how many of them have unscheduled inspections?

### Hint
unscheduled inspections refer to type = 'Routine - Unschedule'; year(date) = 2016;

### SQL
SELECT COUNT(T2.business_id) FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2016' AND T2.type = 'Routine - Unscheduled'
### Database Schema
CREATE TABLE `businesses` (
  `business_id` INTEGER NOT NULL,
  `name` TEXT NOT NULL,
  `address` TEXT DEFAULT NULL,
  `city` TEXT DEFAULT NULL,
  `postal_code` TEXT DEFAULT NULL,
  `latitude` REAL DEFAULT NULL,
  `longitude` REAL DEFAULT NULL,
  `phone_number` INTEGER DEFAULT NULL,
  `tax_code` TEXT DEFAULT NULL,
  `business_certificate` INTEGER NOT NULL,
  `application_date` DATE DEFAULT NULL,
  `owner_name` TEXT NOT NULL,
  `owner_address` TEXT DEFAULT NULL,
  `owner_city` TEXT DEFAULT NULL,
  `owner_state` TEXT DEFAULT NULL,
  `owner_zip` TEXT DEFAULT NULL,
  PRIMARY KEY (`business_id`)
)

CREATE TABLE `inspections` (
  `business_id` INTEGER NOT NULL,
  `score` INTEGER DEFAULT NULL,
  `date` DATE NOT NULL,
  `type` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

CREATE TABLE `violations` (
  `business_id` INTEGER NOT NULL,
  `date` DATE NOT NULL,
  `violation_type_id` TEXT NOT NULL,
  `risk_category` TEXT NOT NULL,
  `description` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

### Question
List the business' name and risk category of businesses with a score greater than the 80% of average score of all businesses.

### Hint
score greater than the 80% of average score of all businesses refers to score > MULTIPLY(0.8, avg(score) from inspections);

### SQL
SELECT DISTINCT T1.name, T3.risk_category FROM businesses AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id INNER JOIN violations AS T3 ON T1.business_id = T3.business_id WHERE T2.score > 0.8 * ( SELECT AVG(score) FROM inspections )
### Database Schema
CREATE TABLE `businesses` (
  `business_id` INTEGER NOT NULL,
  `name` TEXT NOT NULL,
  `address` TEXT DEFAULT NULL,
  `city` TEXT DEFAULT NULL,
  `postal_code` TEXT DEFAULT NULL,
  `latitude` REAL DEFAULT NULL,
  `longitude` REAL DEFAULT NULL,
  `phone_number` INTEGER DEFAULT NULL,
  `tax_code` TEXT DEFAULT NULL,
  `business_certificate` INTEGER NOT NULL,
  `application_date` DATE DEFAULT NULL,
  `owner_name` TEXT NOT NULL,
  `owner_address` TEXT DEFAULT NULL,
  `owner_city` TEXT DEFAULT NULL,
  `owner_state` TEXT DEFAULT NULL,
  `owner_zip` TEXT DEFAULT NULL,
  PRIMARY KEY (`business_id`)
)

CREATE TABLE `inspections` (
  `business_id` INTEGER NOT NULL,
  `score` INTEGER DEFAULT NULL,
  `date` DATE NOT NULL,
  `type` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

CREATE TABLE `violations` (
  `business_id` INTEGER NOT NULL,
  `date` DATE NOT NULL,
  `violation_type_id` TEXT NOT NULL,
  `risk_category` TEXT NOT NULL,
  `description` TEXT NOT NULL,
  FOREIGN KEY (`business_id`) REFERENCES `businesses` (`business_id`)
)

### Question
In businesses with a score lower than 95 and located around the postal code of 94110, what is the percentage of businesses with a risk category of low risk?

### Hint
DIVIDE(COUNT(business_id where risk_category = 'Low Risk', score < 95 and postal_code = 94110), COUNT(business_id where score < 95 and postal_code = 94110)) as percentage;

### SQL
SELECT CAST(SUM(CASE WHEN T1.risk_category = 'Low Risk' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.risk_category) FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id INNER JOIN businesses AS T3 ON T2.business_id = T3.business_id WHERE T2.score < 95 AND T3.postal_code = 94110
### Database Schema
CREATE TABLE breweries
(
    id    INTEGER          not null
        primary key,
    name  TEXT null,
    city  TEXT null,
    state TEXT null
)

CREATE TABLE "beers"
(
    id         INTEGER not null
        primary key,
    brewery_id INTEGER not null
        constraint beers_ibfk_1
            references breweries,
    abv        REAL,
    ibu        REAL,
    name       TEXT    not null,
    style      TEXT,
    ounces     REAL    not null
)

### Question
Which distinct state makes beer that has the least amount of bitterness?

### SQL
SELECT DISTINCT T2.state, T1.ibu FROM beers AS T1 INNER JOIN breweries AS T2 ON T1.brewery_id = T2.id WHERE T1.ibu IS NOT NULL AND T1.ibu = ( SELECT MIN(ibu) FROM beers )
### Database Schema
CREATE TABLE breweries
(
    id    INTEGER          not null
        primary key,
    name  TEXT null,
    city  TEXT null,
    state TEXT null
)

CREATE TABLE "beers"
(
    id         INTEGER not null
        primary key,
    brewery_id INTEGER not null
        constraint beers_ibfk_1
            references breweries,
    abv        REAL,
    ibu        REAL,
    name       TEXT    not null,
    style      TEXT,
    ounces     REAL    not null
)

### Question
Where in New York can you locate the brewery that makes the bitterest beer? List both the brewery's name and the name of the city.

### Hint
The more IBU, the more bitter the beer is, bitterest means highest IBU.

### SQL
SELECT T2.name, T2.city FROM beers AS T1 INNER JOIN breweries AS T2 ON T1.brewery_id = T2.id WHERE T2.state = 'NY' ORDER BY T1.ibu DESC LIMIT 1
### Database Schema
CREATE TABLE breweries
(
    id    INTEGER          not null
        primary key,
    name  TEXT null,
    city  TEXT null,
    state TEXT null
)

CREATE TABLE "beers"
(
    id         INTEGER not null
        primary key,
    brewery_id INTEGER not null
        constraint beers_ibfk_1
            references breweries,
    abv        REAL,
    ibu        REAL,
    name       TEXT    not null,
    style      TEXT,
    ounces     REAL    not null
)

### Question
What is the average alcohol content per 12-ounce beer bottle produced by Boston Beer Company?

### SQL
SELECT AVG(T1.abv) FROM beers AS T1 INNER JOIN breweries AS T2 ON T1.brewery_id = T2.id WHERE T2.name = 'Boston Beer Company' AND T1.ounces = 12
### Database Schema
CREATE TABLE breweries
(
    id    INTEGER          not null
        primary key,
    name  TEXT null,
    city  TEXT null,
    state TEXT null
)

CREATE TABLE "beers"
(
    id         INTEGER not null
        primary key,
    brewery_id INTEGER not null
        constraint beers_ibfk_1
            references breweries,
    abv        REAL,
    ibu        REAL,
    name       TEXT    not null,
    style      TEXT,
    ounces     REAL    not null
)

### Question
Of all the beer styles produced by Stevens Point Brewery, how many percent do they allot for American Adjunct Lager?

### Hint
Percent allotted = count(American Adjunct Lager beer styles) / count(styles) * 100%

### SQL
SELECT CAST(SUM(IIF(T1.style = 'American Adjunct Lager', 1, 0)) AS REAL) * 100 / COUNT(T1.brewery_id) FROM beers AS T1 INNER JOIN breweries AS T2 ON T1.brewery_id = T2.id WHERE T2.name = 'Stevens Point Brewery'