lianghsun/spider-text2sql-bench huggingface dataset:
### Database Schema
CREATE TABLE works_on(
Essn INTEGER,
Pno INTEGER,
Hours REAL,
PRIMARY KEY(Essn, Pno))

CREATE TABLE employee(
Fname TEXT,
Minit TEXT,
Lname TEXT,
Ssn INTEGER PRIMARY KEY,
Bdate TEXT,
Address TEXT,
Sex TEXT,
Salary INTEGER,
Super_ssn INTEGER, 
Dno INTEGER)

CREATE TABLE department(
Dname TEXT,
Dnumber INTEGER PRIMARY KEY,
Mgr_ssn INTEGER,
Mgr_start_date TEXT)

CREATE TABLE project(
Pname Text,
Pnumber INTEGER PRIMARY KEY,
Plocation TEXT,
Dnum INTEGER)

CREATE TABLE dependent(
Essn INTEGER,
Dependent_name TEXT,
Sex TEXT,
Bdate TEXT,
Relationship TEXT,
PRIMARY KEY(Essn, Dependent_name))

CREATE TABLE dept_locations(
Dnumber INTEGER,
Dlocation TEXT,
PRIMARY KEY(Dnumber, Dlocation))

### Question
Return the first names and last names of employees who earn more than 30000 in salary.

### SQL
SELECT fname ,  lname FROM employee WHERE salary  >  30000
### Database Schema
CREATE TABLE works_on(
Essn INTEGER,
Pno INTEGER,
Hours REAL,
PRIMARY KEY(Essn, Pno))

CREATE TABLE employee(
Fname TEXT,
Minit TEXT,
Lname TEXT,
Ssn INTEGER PRIMARY KEY,
Bdate TEXT,
Address TEXT,
Sex TEXT,
Salary INTEGER,
Super_ssn INTEGER, 
Dno INTEGER)

CREATE TABLE department(
Dname TEXT,
Dnumber INTEGER PRIMARY KEY,
Mgr_ssn INTEGER,
Mgr_start_date TEXT)

CREATE TABLE project(
Pname Text,
Pnumber INTEGER PRIMARY KEY,
Plocation TEXT,
Dnum INTEGER)

CREATE TABLE dependent(
Essn INTEGER,
Dependent_name TEXT,
Sex TEXT,
Bdate TEXT,
Relationship TEXT,
PRIMARY KEY(Essn, Dependent_name))

CREATE TABLE dept_locations(
Dnumber INTEGER,
Dlocation TEXT,
PRIMARY KEY(Dnumber, Dlocation))

### Question
Find the number of employees of each gender whose salary is lower than 50000.

### SQL
SELECT count(*) ,  sex FROM employee WHERE salary  <  50000 GROUP BY sex
### Database Schema
CREATE TABLE works_on(
Essn INTEGER,
Pno INTEGER,
Hours REAL,
PRIMARY KEY(Essn, Pno))

CREATE TABLE employee(
Fname TEXT,
Minit TEXT,
Lname TEXT,
Ssn INTEGER PRIMARY KEY,
Bdate TEXT,
Address TEXT,
Sex TEXT,
Salary INTEGER,
Super_ssn INTEGER, 
Dno INTEGER)

CREATE TABLE department(
Dname TEXT,
Dnumber INTEGER PRIMARY KEY,
Mgr_ssn INTEGER,
Mgr_start_date TEXT)

CREATE TABLE project(
Pname Text,
Pnumber INTEGER PRIMARY KEY,
Plocation TEXT,
Dnum INTEGER)

CREATE TABLE dependent(
Essn INTEGER,
Dependent_name TEXT,
Sex TEXT,
Bdate TEXT,
Relationship TEXT,
PRIMARY KEY(Essn, Dependent_name))

CREATE TABLE dept_locations(
Dnumber INTEGER,
Dlocation TEXT,
PRIMARY KEY(Dnumber, Dlocation))

### Question
list the first and last names, and the addresses of all employees in the ascending order of their birth date.

### SQL
SELECT fname ,  lname ,  address FROM employee ORDER BY Bdate
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
what are the event details of the services that have the type code 'Marriage'?

### SQL
SELECT T1.event_details FROM EVENTS AS T1 JOIN Services AS T2 ON T1.Service_ID  =  T2.Service_ID WHERE T2.Service_Type_Code  =  'Marriage'
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
What are the ids and details of events that have more than one participants?

### SQL
SELECT T1.event_id ,  T1.event_details FROM EVENTS AS T1 JOIN Participants_in_Events AS T2 ON T1.Event_ID  =  T2.Event_ID GROUP BY T1.Event_ID HAVING count(*)  >  1
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
How many events have each participants attended? List the participant id, type and the number.

### SQL
SELECT T1.Participant_ID ,  T1.Participant_Type_Code ,  count(*) FROM Participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID  =  T2.Participant_ID GROUP BY T1.Participant_ID
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
What are all the the participant ids, type code and details?

### SQL
SELECT Participant_ID ,  Participant_Type_Code ,  Participant_Details FROM  Participants
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
How many participants belong to the type 'Organizer'?

### SQL
SELECT count(*) FROM participants WHERE participant_type_code  =  'Organizer'
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
List the type of the services in alphabetical order.

### SQL
SELECT service_type_code FROM services ORDER BY service_type_code
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
List the service id and details for the events.

### SQL
SELECT service_id ,  event_details FROM EVENTS
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
How many events had participants whose details had the substring 'Dr.'

### SQL
SELECT count(*) FROM participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID  =  T2.Participant_ID WHERE T1.participant_details LIKE '%Dr.%'
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
What is the most common participant type?

### SQL
SELECT participant_type_code FROM participants GROUP BY participant_type_code ORDER BY count(*) DESC LIMIT 1
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
Which service id and type has the least number of participants?

### SQL
SELECT T3.service_id ,  T4.Service_Type_Code FROM participants AS T1 JOIN Participants_in_Events AS T2 ON T1.Participant_ID  =  T2.Participant_ID JOIN EVENTS AS T3 ON T2.Event_ID   =  T3.Event_ID JOIN services AS T4 ON T3.service_id  =  T4.service_id GROUP BY T3.service_id ORDER BY count(*) ASC LIMIT 1
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
What is the id of the event with the most participants?

### SQL
SELECT Event_ID FROM Participants_in_Events GROUP BY Event_ID ORDER BY count(*) DESC LIMIT 1
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
Which events id does not have any participant with detail 'Kenyatta Kuhn'?

### SQL
SELECT event_id FROM EVENTS EXCEPT SELECT T1.event_id FROM Participants_in_Events AS T1 JOIN Participants AS T2 ON T1.Participant_ID  =  T2.Participant_ID WHERE Participant_Details  =  'Kenyatta Kuhn'
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
Which services type had both successful and failure event details?

### SQL
SELECT T1.service_type_code FROM services AS T1 JOIN EVENTS AS T2 ON T1.service_id  =  T2.service_id WHERE T2.event_details  =  'Success' INTERSECT SELECT T1.service_type_code FROM services AS T1 JOIN EVENTS AS T2 ON T1.service_id  =  T2.service_id WHERE T2.event_details  =  'Fail'
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
How many events did not have any participants?

### SQL
SELECT count(*) FROM EVENTS WHERE event_id NOT IN (SELECT event_id FROM Participants_in_Events)
### Database Schema
CREATE TABLE Services (
Service_ID INTEGER NOT NULL,
Service_Type_Code CHAR(15) NOT NULL,
PRIMARY KEY (Service_ID)
)

CREATE TABLE Participants (
Participant_ID INTEGER NOT NULL,
Participant_Type_Code CHAR(15) NOT NULL,
Participant_Details VARCHAR(255),
PRIMARY KEY (Participant_ID)
)

CREATE TABLE Events (
Event_ID INTEGER NOT NULL,
Service_ID INTEGER NOT NULL,
Event_Details VARCHAR(255),
PRIMARY KEY (Event_ID),
FOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)
)

CREATE TABLE Participants_in_Events (
Event_ID INTEGER NOT NULL,
Participant_ID INTEGER NOT NULL,
PRIMARY KEY (Event_ID, Participant_ID),
FOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),
FOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)
)

### Question
What are all the distinct participant ids who attended any events?

### SQL
SELECT count(DISTINCT participant_id) FROM participants_in_Events
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
How many technicians are there?

### SQL
SELECT count(*) FROM technician
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What is the number of technicians?

### SQL
SELECT count(*) FROM technician
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
List the names of technicians in ascending order of age.

### SQL
SELECT Name FROM technician ORDER BY Age ASC
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What are the names of the technicians by ascending order of age?

### SQL
SELECT Name FROM technician ORDER BY Age ASC
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What are the team and starting year of technicians?

### SQL
SELECT Team ,  Starting_Year FROM technician
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What is the team and starting year for each technician?

### SQL
SELECT Team ,  Starting_Year FROM technician
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
List the name of technicians whose team is not "NYY".

### SQL
SELECT Name FROM technician WHERE Team != "NYY"
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What is the name of the technician whose team is not 'NYY'?

### SQL
SELECT Name FROM technician WHERE Team != "NYY"
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
Show the name of technicians aged either 36 or 37

### SQL
SELECT Name FROM technician WHERE Age  =  36 OR Age  =  37
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What are the names of the technicians aged either 36 or 37?

### SQL
SELECT Name FROM technician WHERE Age  =  36 OR Age  =  37
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What is the starting year of the oldest technicians?

### SQL
SELECT Starting_Year FROM technician ORDER BY Age DESC LIMIT 1
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What is the starting year for the oldest technician?

### SQL
SELECT Starting_Year FROM technician ORDER BY Age DESC LIMIT 1
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
Show different teams of technicians and the number of technicians in each team.

### SQL
SELECT Team ,  COUNT(*) FROM technician GROUP BY Team
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
For each team, how many technicians are there?

### SQL
SELECT Team ,  COUNT(*) FROM technician GROUP BY Team
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
Please show the team that has the most number of technicians.

### SQL
SELECT Team FROM technician GROUP BY Team ORDER BY COUNT(*) DESC LIMIT 1
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What are the teams with the most technicians?

### SQL
SELECT Team FROM technician GROUP BY Team ORDER BY COUNT(*) DESC LIMIT 1
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
Show the team that have at least two technicians.

### SQL
SELECT Team FROM technician GROUP BY Team HAVING COUNT(*)  >=  2
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What is the team with at least 2 technicians?

### SQL
SELECT Team FROM technician GROUP BY Team HAVING COUNT(*)  >=  2
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
Show names of technicians and series of machines they are assigned to repair.

### SQL
SELECT T3.Name ,  T2.Machine_series FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What are the names of technicians and the machine series that they repair?

### SQL
SELECT T3.Name ,  T2.Machine_series FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
Show names of technicians in ascending order of quality rank of the machine they are assigned.

### SQL
SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID ORDER BY T2.quality_rank
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What are the names of the technicians by ascending order of quality rank for the machine they are assigned?

### SQL
SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID ORDER BY T2.quality_rank
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
Show names of technicians who are assigned to repair machines with value point more than 70.

### SQL
SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID WHERE T2.value_points  >  70
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What are the names of the technicians that are assigned to repair machines with more point values than 70?

### SQL
SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id  =  T2.machine_id JOIN technician AS T3 ON T1.technician_ID  =  T3.technician_ID WHERE T2.value_points  >  70
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
Show names of technicians and the number of machines they are assigned to repair.

### SQL
SELECT T2.Name ,  COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_ID  =  T2.technician_ID GROUP BY T2.Name
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What are the names of the technicians  and how many machines are they assigned to repair?

### SQL
SELECT T2.Name ,  COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_ID  =  T2.technician_ID GROUP BY T2.Name
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
List the names of technicians who have not been assigned to repair machines.

### SQL
SELECT Name FROM technician WHERE technician_id NOT IN (SELECT technician_id FROM repair_assignment)
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What are the names of the technicians that have not been assigned to repair machines?

### SQL
SELECT Name FROM technician WHERE technician_id NOT IN (SELECT technician_id FROM repair_assignment)
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
Show the starting years shared by technicians from team "CLE" and "CWS".

### SQL
SELECT Starting_Year FROM technician WHERE Team  =  "CLE" INTERSECT SELECT Starting_Year FROM technician WHERE Team  =  "CWS"
### Database Schema
CREATE TABLE "repair" (
"repair_ID" int,
"name" text,
"Launch_Date" text,
"Notes" text,
PRIMARY KEY ("repair_ID")
)

CREATE TABLE "machine" (
"Machine_ID" int,
"Making_Year" int,
"Class" text,
"Team" text,
"Machine_series" text,
"value_points" real,
"quality_rank" int,
PRIMARY KEY ("Machine_ID")
)

CREATE TABLE "technician" (
"technician_id" real,
"Name" text,
"Team" text,
"Starting_Year" real,
"Age" int,
PRIMARY Key ("technician_id")
)

CREATE TABLE "repair_assignment" (
"technician_id" int,
"repair_ID" int,
"Machine_ID" int,
PRIMARY Key ("technician_id","repair_ID","Machine_ID"),
FOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),
FOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),
FOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)
)

### Question
What are the starting years shared by the technicians from the team "CLE" or "CWS"?

### SQL
SELECT Starting_Year FROM technician WHERE Team  =  "CLE" INTERSECT SELECT Starting_Year FROM technician WHERE Team  =  "CWS"
### Database Schema
CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)

CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)

### Question
How many entrepreneurs are there?

### SQL
SELECT count(*) FROM entrepreneur
### Database Schema
CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)

CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)

### Question
Count the number of entrepreneurs.

### SQL
SELECT count(*) FROM entrepreneur
### Database Schema
CREATE TABLE "entrepreneur" (
"Entrepreneur_ID" int,
"People_ID" int,
"Company" text,
"Money_Requested" real,
"Investor" text,
PRIMARY KEY ("Entrepreneur_ID"),
FOREIGN KEY ("People_ID") REFERENCES "people"("People_ID")
)

CREATE TABLE "people" (
"People_ID" int,
"Name" text,
"Height" real,
"Weight" real,
"Date_of_Birth" text,
PRIMARY KEY ("People_ID")
)

### Question
List the companies of entrepreneurs in descending order of money requested.

### SQL
SELECT Company FROM entrepreneur ORDER BY Money_Requested DESC