db_id
stringclasses
140 values
messages
listlengths
2
2
insurance_fnol
[ { "content": "Translate the following question to SQL: Find the policy types more than 4 customers use. Show their type code.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING count(*) > 4", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Find the total and average amount of settlements.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT sum(settlement_amount) , avg(settlement_amount) FROM settlements", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Return the sum and average of all settlement amounts.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT sum(settlement_amount) , avg(settlement_amount) FROM settlements", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Find the name of services that have been used for more than 2 times in first notification of loss.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT t2.service_name FROM first_notification_of_loss AS t1 JOIN services AS t2 ON t1.service_id = t2.service_id GROUP BY t1.service_id HAVING count(*) > 2", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Which services have been used more than twice in first notification of loss? Return the service name.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT t2.service_name FROM first_notification_of_loss AS t1 JOIN services AS t2 ON t1.service_id = t2.service_id GROUP BY t1.service_id HAVING count(*) > 2", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: What is the effective date of the claim that has the largest amount of total settlement?\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT t1.Effective_Date FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY sum(t2.settlement_amount) DESC LIMIT 1", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Find the claim that has the largest total settlement amount. Return the effective date of the claim.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT t1.Effective_Date FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY sum(t2.settlement_amount) DESC LIMIT 1", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: How many policies are listed for the customer named \"Dayana Robel\"?\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT count(*) FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = \"Dayana Robel\"", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Count the total number of policies used by the customer named \"Dayana Robel\".\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT count(*) FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = \"Dayana Robel\"", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: What is the name of the customer who has the most policies listed?\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Which customer uses the most policies? Give me the customer name.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: What are all the policy types of the customer named \"Dayana Robel\"?\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = \"Dayana Robel\"", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Tell me the types of the policy used by the customer named \"Dayana Robel\".\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = \"Dayana Robel\"", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: What are all the policy types of the customer that has the most policies listed?\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = (SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY count(*) DESC LIMIT 1)", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: List all the policy types used by the customer enrolled in the most policies.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT DISTINCT t3.policy_type_code FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id JOIN available_policies AS t3 ON t2.policy_id = t3.policy_id WHERE t1.customer_name = (SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY count(*) DESC LIMIT 1)", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: List all the services in the alphabetical order.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT service_name FROM services ORDER BY service_name", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Give me a list of all the service names sorted alphabetically.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT service_name FROM services ORDER BY service_name", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: How many services are there?\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT count(*) FROM services", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Count the total number of available services.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT count(*) FROM services", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Find the names of users who do not have a first notification of loss record.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Which customers do not have a first notification of loss record? Give me the customer names.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Find the names of customers who have used either the service \"Close a policy\" or the service \"Upgrade a policy\".\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = \"Close a policy\" OR t3.service_name = \"Upgrade a policy\"", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Which customers have used the service named \"Close a policy\" or \"Upgrade a policy\"? Give me the customer names.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = \"Close a policy\" OR t3.service_name = \"Upgrade a policy\"", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Find the names of customers who have used both the service \"Close a policy\" and the service \"New policy application\".\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = \"Close a policy\" INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = \"New policy application\"", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Which customers have used both the service named \"Close a policy\" and the service named \"Upgrade a policy\"? Give me the customer names.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = \"Close a policy\" INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = \"New policy application\"", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Find the IDs of customers whose name contains \"Diana\".\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT customer_id FROM customers WHERE customer_name LIKE \"%Diana%\"", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: What are the IDs of customers who have \"Diana\" in part of their names?\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT customer_id FROM customers WHERE customer_name LIKE \"%Diana%\"", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: What are the maximum and minimum settlement amount on record?\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT max(settlement_amount) , min(settlement_amount) FROM settlements", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Find the maximum and minimum settlement amount.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT max(settlement_amount) , min(settlement_amount) FROM settlements", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: List all the customers in increasing order of IDs.\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT customer_id , customer_name FROM customers ORDER BY customer_id ASC", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: What is the ordered list of customer ids?\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT customer_id , customer_name FROM customers ORDER BY customer_id ASC", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: Retrieve the open and close dates of all the policies associated with the customer whose name contains \"Diana\"\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT t2.date_opened , t2.date_closed FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name LIKE \"%Diana%\"", "role": "assistant" } ]
insurance_fnol
[ { "content": "Translate the following question to SQL: What are the open and close dates of all the policies used by the customer who have \"Diana\" in part of their names?\n\nSchema: CREATE TABLE Customers (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_name VARCHAR(40)\n);\n\nCREATE TABLE Services (\n Service_ID INTEGER NOT NULL PRIMARY KEY,\n Service_name VARCHAR(40)\n);\n\nCREATE TABLE Available_Policies (\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n policy_type_code CHAR(15),\n Customer_Phone VARCHAR(255),\n UNIQUE (Policy_ID)\n);\n\nCREATE TABLE Customers_Policies (\n Customer_ID INTEGER NOT NULL PRIMARY KEY,\n Policy_ID INTEGER NOT NULL PRIMARY KEY,\n Date_Opened DATE,\n Date_Closed DATE,\n PRIMARY KEY (Customer_ID, Policy_ID),\n UNIQUE (Customer_ID, Policy_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Available_Policies(Policy_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers(Customer_ID)\n);\n\nCREATE TABLE First_Notification_of_Loss (\n FNOL_ID INTEGER NOT NULL PRIMARY KEY,\n Customer_ID INTEGER NOT NULL,\n Policy_ID INTEGER NOT NULL,\n Service_ID INTEGER NOT NULL,\n UNIQUE (FNOL_ID),\n FOREIGN KEY (Customer_ID) REFERENCES Customers_Policies(Customer_ID),\n FOREIGN KEY (Policy_ID) REFERENCES Customers_Policies(Policy_ID),\n FOREIGN KEY (Service_ID) REFERENCES Services(Service_ID)\n);\n\nCREATE TABLE Claims (\n Claim_ID INTEGER NOT NULL PRIMARY KEY,\n FNOL_ID INTEGER NOT NULL,\n Effective_Date DATE,\n UNIQUE (Claim_ID),\n FOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss(FNOL_ID)\n);\n\nCREATE TABLE Settlements (\n Settlement_ID INTEGER NOT NULL PRIMARY KEY,\n Claim_ID INTEGER,\n Effective_Date DATE,\n Settlement_Amount REAL,\n UNIQUE (Settlement_ID),\n FOREIGN KEY (Claim_ID) REFERENCES Claims(Claim_ID)\n);", "role": "user" }, { "content": "SELECT t2.date_opened , t2.date_closed FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name LIKE \"%Diana%\"", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: How many kinds of enzymes are there?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM enzyme", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What is the total count of enzymes?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM enzyme", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: List the name of enzymes in descending lexicographical order.\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT name FROM enzyme ORDER BY name DESC", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the names of enzymes in descending order?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT name FROM enzyme ORDER BY name DESC", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: List the names and the locations that the enzymes can make an effect.\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT name , LOCATION FROM enzyme", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the names and locations of all enzymes listed?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT name , LOCATION FROM enzyme", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What is the maximum Online Mendelian Inheritance in Man (OMIM) value of the enzymes?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT max(OMIM) FROM enzyme", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What is the maximum OMIM value in the database?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT max(OMIM) FROM enzyme", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What is the product, chromosome and porphyria related to the enzymes which take effect at the location 'Cytosol'?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT product , chromosome , porphyria FROM enzyme WHERE LOCATION = 'Cytosol'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What is the product, chromosome, and porphyria of the enzymes located at 'Cytosol'?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT product , chromosome , porphyria FROM enzyme WHERE LOCATION = 'Cytosol'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the names of enzymes who does not produce 'Heme'?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT name FROM enzyme WHERE product != 'Heme'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the names of enzymes whose product is not 'Heme'?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT name FROM enzyme WHERE product != 'Heme'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the names and trade names of the medicines which has 'Yes' value in the FDA record?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT name , trade_name FROM medicine WHERE FDA_approved = 'Yes'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the names and trade names of the medcines that are FDA approved?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT name , trade_name FROM medicine WHERE FDA_approved = 'Yes'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the names of enzymes in the medicine named 'Amisulpride' that can serve as an 'inhibitor'?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id JOIN medicine AS T3 ON T2.medicine_id = T3.id WHERE T3.name = 'Amisulpride' AND T2.interaction_type = 'inhibitor'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the names of the enzymes used in the medicine Amisulpride that acts as inhibitors?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id JOIN medicine AS T3 ON T2.medicine_id = T3.id WHERE T3.name = 'Amisulpride' AND T2.interaction_type = 'inhibitor'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the ids and names of the medicine that can interact with two or more enzymes?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.id , T1.Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING count(*) >= 2", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: For every medicine id, what are the names of the medicines that can interact with more than one enzyme?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.id , T1.Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING count(*) >= 2", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the ids, names and FDA approval status of medicines in descending order of the number of enzymes that it can interact with.\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.id , T1.Name , T1.FDA_approved FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id ORDER BY count(*) DESC", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the ids, names, and FDA approval status for medicines ordered by descending number of possible enzyme interactions?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.id , T1.Name , T1.FDA_approved FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id ORDER BY count(*) DESC", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What is the id and name of the enzyme with most number of medicines that can interact as 'activator'?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.id , T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id WHERE T2.interaction_type = 'activitor' GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What is the id and name of the enzyme that can interact with the most medicines as an activator?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.id , T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id WHERE T2.interaction_type = 'activitor' GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What is the interaction type of the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What is the type of interaction for the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What is the most common interaction type between enzymes and medicine? And how many are there?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT interaction_type , count(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the most common types of interactions between enzymes and medicine, and how many types are there?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT interaction_type , count(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: How many medicines have the FDA approval status 'No' ?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM medicine WHERE FDA_approved = 'No'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: How many medicines were not approved by the FDA?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM medicine WHERE FDA_approved = 'No'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: How many enzymes do not have any interactions?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM enzyme WHERE id NOT IN ( SELECT enzyme_id FROM medicine_enzyme_interaction );", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What is the count of enzymes without any interactions?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT count(*) FROM enzyme WHERE id NOT IN ( SELECT enzyme_id FROM medicine_enzyme_interaction );", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What is the id and trade name of the medicines can interact with at least 3 enzymes?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.id , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 3", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the ids and trade names of the medicine that can interact with at least 3 enzymes?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.id , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 3", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the distinct name, location and products of the enzymes which has any 'inhibitor' interaction?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT DISTINCT T1.name , T1.location , T1.product FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id = T1.id WHERE T2.interaction_type = 'inhibitor'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the different names, locations, and products of the enzymes that are capable inhibitor interactions?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT DISTINCT T1.name , T1.location , T1.product FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id = T1.id WHERE T2.interaction_type = 'inhibitor'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: List the medicine name and trade name which can both interact as 'inhibitor' and 'activitor' with enzymes.\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'inhibitor' INTERSECT SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'activitor'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the medicine and trade names that can interact as an inhibitor and activitor with enzymes?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'inhibitor' INTERSECT SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'activitor'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: Show the medicine names and trade names that cannot interact with the enzyme with product 'Heme'.\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT name , trade_name FROM medicine EXCEPT SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id JOIN enzyme AS T3 ON T3.id = T2.enzyme_id WHERE T3.product = 'Protoporphyrinogen IX'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the medicine and trade names that cannot interact with the enzyme with the product 'Heme'?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT name , trade_name FROM medicine EXCEPT SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id JOIN enzyme AS T3 ON T3.id = T2.enzyme_id WHERE T3.product = 'Protoporphyrinogen IX'", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: How many distinct FDA approval statuses are there for the medicines?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT FDA_approved) FROM medicine", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: How many different FDA approval statuses exist for medicines?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT FDA_approved) FROM medicine", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: Which enzyme names have the substring \"ALA\"?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT name FROM enzyme WHERE name LIKE \"%ALA%\"", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: What are the names of enzymes that include the string 'ALA'?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT name FROM enzyme WHERE name LIKE \"%ALA%\"", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: find the number of medicines offered by each trade.\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT trade_name , count(*) FROM medicine GROUP BY trade_name", "role": "assistant" } ]
medicine_enzyme_interaction
[ { "content": "Translate the following question to SQL: How many medicines are offered by each trade name?\n\nSchema: CREATE TABLE medicine (\n id INT PRIMARY KEY,\n name TEXT,\n Trade_Name TEXT,\n FDA_approved TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE enzyme (\n id INT PRIMARY KEY,\n name TEXT,\n Location TEXT,\n Product TEXT,\n Chromosome TEXT,\n OMIM INT,\n Porphyria TEXT,\n UNIQUE (id)\n);\n\nCREATE TABLE medicine_enzyme_interaction (\n enzyme_id INT PRIMARY KEY,\n medicine_id INT PRIMARY KEY,\n interaction_type TEXT,\n PRIMARY KEY (enzyme_id, medicine_id),\n UNIQUE (enzyme_id, medicine_id),\n FOREIGN KEY (medicine_id) REFERENCES medicine(id),\n FOREIGN KEY (enzyme_id) REFERENCES enzyme(id)\n);", "role": "user" }, { "content": "SELECT trade_name , count(*) FROM medicine GROUP BY trade_name", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: List all schools and their nicknames in the order of founded year.\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT school , nickname FROM university ORDER BY founded", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: What are the different schools and their nicknames, ordered by their founding years?\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT school , nickname FROM university ORDER BY founded", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: List all public schools and their locations.\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT school , LOCATION FROM university WHERE affiliation = 'Public'", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: What are the public schools and what are their locations?\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT school , LOCATION FROM university WHERE affiliation = 'Public'", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: When was the school with the largest enrollment founded?\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT founded FROM university ORDER BY enrollment DESC LIMIT 1", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: Return the founded year for the school with the largest enrollment.\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT founded FROM university ORDER BY enrollment DESC LIMIT 1", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: Find the founded year of the newest non public school.\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT founded FROM university WHERE affiliation != 'Public' ORDER BY founded DESC LIMIT 1", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: What is the founded year of the non public school that was founded most recently?\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT founded FROM university WHERE affiliation != 'Public' ORDER BY founded DESC LIMIT 1", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: How many schools are in the basketball match?\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT school_id) FROM basketball_match", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: Count the number of schools that have had basketball matches.\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT school_id) FROM basketball_match", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: What is the highest acc percent score in the competition?\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT acc_percent FROM basketball_match ORDER BY acc_percent DESC LIMIT 1", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: Return the highest acc percent across all basketball matches.\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT acc_percent FROM basketball_match ORDER BY acc_percent DESC LIMIT 1", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: What is the primary conference of the school that has the lowest acc percent score in the competition?\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT t1.Primary_conference FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t2.acc_percent LIMIT 1", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: Return the primary conference of the school with the lowest acc percentage score.\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT t1.Primary_conference FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t2.acc_percent LIMIT 1", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: What is the team name and acc regular season score of the school that was founded for the longest time?\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT t2.team_name , t2.ACC_Regular_Season FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t1.founded LIMIT 1", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: Return the name of the team and the acc during the regular season for the school that was founded the earliest.\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT t2.team_name , t2.ACC_Regular_Season FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id ORDER BY t1.founded LIMIT 1", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: Find the location and all games score of the school that has Clemson as its team name.\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT t2.All_Games , t1.location FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id WHERE team_name = 'Clemson'", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: What are the all games score and location of the school called Clemson?\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT t2.All_Games , t1.location FROM university AS t1 JOIN basketball_match AS t2 ON t1.school_id = t2.school_id WHERE team_name = 'Clemson'", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: What are the average enrollment size of the universities that are founded before 1850?\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT avg(enrollment) FROM university WHERE founded < 1850", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: Return the average enrollment of universities founded before 1850.\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT avg(enrollment) FROM university WHERE founded < 1850", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: Show the enrollment and primary_conference of the oldest college.\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT enrollment , primary_conference FROM university ORDER BY founded LIMIT 1", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: What are the enrollment and primary conference for the university which was founded the earliest?\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT enrollment , primary_conference FROM university ORDER BY founded LIMIT 1", "role": "assistant" } ]
university_basketball
[ { "content": "Translate the following question to SQL: What is the total and minimum enrollment of all schools?\n\nSchema: CREATE TABLE basketball_match (\n Team_ID INT PRIMARY KEY,\n School_ID INT,\n Team_Name TEXT,\n ACC_Regular_Season TEXT,\n ACC_Percent TEXT,\n ACC_Home TEXT,\n ACC_Road TEXT,\n All_Games TEXT,\n All_Games_Percent INT,\n All_Home TEXT,\n All_Road TEXT,\n All_Neutral TEXT,\n UNIQUE (Team_ID),\n FOREIGN KEY (School_ID) REFERENCES university(School_ID)\n);\n\nCREATE TABLE university (\n School_ID INT PRIMARY KEY,\n School TEXT,\n Location TEXT,\n Founded REAL,\n Affiliation TEXT,\n Enrollment REAL,\n Nickname TEXT,\n Primary_conference TEXT,\n UNIQUE (School_ID)\n);", "role": "user" }, { "content": "SELECT sum(enrollment) , min(enrollment) FROM university", "role": "assistant" } ]