input
stringlengths
193
2.69k
output
stringlengths
24
744
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2actors : movieid [ INTEGER ] actorid [ INTEGER ] cast_num [ INTEGER ] Please write me a SQL statement that answers the following question: Please list the actor IDs whose movies have the newest published date. [/INST]
SELECT T1.actorid FROM movies2actors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.year = 4;
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2actors : movieid [ INTEGER ] actorid [ INTEGER ] cast_num [ INTEGER ] Please write me a SQL statement that answers the following question: Who are cast members in an English movie which has a running time equal to 2? Please list their IDs. [/INST]
SELECT T2.actorid FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.runningtime = 2 AND T1.isEnglish = 'T';
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2actors : movieid [ INTEGER ] actorid [ INTEGER ] cast_num [ INTEGER ] Please write me a SQL statement that answers the following question: Which actor has acted in at least 2 French films? Please list their IDs. [/INST]
SELECT T2.actorid FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'France' GROUP BY T2.actorid HAVING COUNT(T1.movieid) > 2;
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2actors : movieid [ INTEGER ] actorid [ INTEGER ] cast_num [ INTEGER ] Please write me a SQL statement that answers the following question: How many American movies have cast number more than 1? [/INST]
SELECT COUNT(T2.actorid) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'USA' AND T2.cast_num > 1;
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2actors : movieid [ INTEGER ] actorid [ INTEGER ] cast_num [ INTEGER ] Please write me a SQL statement that answers the following question: Please list movie IDs which has the oldest publication date and the cast numbers are zero. [/INST]
SELECT DISTINCT T1.movieid FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.year = 1 AND T2.cast_num = 0;
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2actors : movieid [ INTEGER ] actorid [ INTEGER ] cast_num [ INTEGER ] Please write me a SQL statement that answers the following question: How many actors have acted in both US or UK films? [/INST]
SELECT COUNT(T1.actorid) FROM movies2actors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'USA' OR T2.country = 'UK';
[INST] Here is a database schema: directors : directorid [ INTEGER ] primary_key d_quality [ INTEGER ] avg_revenue [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: How many directors with average revenue of 4 have made either action or adventure films? [/INST]
SELECT COUNT(T1.directorid) FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.avg_revenue = 4 AND (T2.genre = 'Adventure' OR T2.genre = 'Action');
[INST] Here is a database schema: directors : directorid [ INTEGER ] primary_key d_quality [ INTEGER ] avg_revenue [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: Please list director IDs who have the quality of at least 3 and have made at least 2 different genres of movies. [/INST]
SELECT T1.directorid FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality >= 3 GROUP BY T1.directorid HAVING COUNT(T2.movieid) >= 2;
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: How many American comedies are there? [/INST]
SELECT COUNT(T1.movieid) FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'USA' AND T2.genre = 'comedy';
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: How many latest released dramas and action movies? [/INST]
SELECT COUNT(T1.movieid) FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.year = 4 AND T1.genre IN ('Action', 'drama');
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: What horror movies have a running time of at least 2? Please list movie IDs. [/INST]
SELECT T1.movieid FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.runningtime >= 2 AND T1.genre = 'Horror';
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: Please calculate negative critical reception of American movies [/INST]
SELECT CAST(SUM(IIF(T1.rating = 1, 1, 0)) AS REAL) * 100 / COUNT(T1.movieid) FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'USA';
[INST] Here is a database schema: movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: What is the disparate number of the comedy films that got the 1 rating? [/INST]
SELECT COUNT(DISTINCT T1.movieid) FROM movies2directors AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid WHERE T2.rating = 1 AND T1.genre = 'comedy';
[INST] Here is a database schema: directors : directorid [ INTEGER ] primary_key d_quality [ INTEGER ] avg_revenue [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: What's different average revenue status for director who directed the movie that got the most 1 ratings? [/INST]
SELECT DISTINCT T1.avg_revenue FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 5;
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: How many French movies got the highest ranking? [/INST]
SELECT COUNT(movieid) FROM movies WHERE country = 'France' AND movieid IN ( SELECT movieid FROM u2base WHERE rating = ( SELECT MAX(rating) FROM u2base ) );
[INST] Here is a database schema: users : userid [ INTEGER ] primary_key age [ TEXT ] u_gender [ TEXT ] occupation [ TEXT ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: List the movie that has been rated most by 25 years old users. [/INST]
SELECT T2.movieid FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid WHERE T1.age = 25 GROUP BY T2.movieid ORDER BY COUNT(T1.userid) DESC LIMIT 1;
[INST] Here is a database schema: users : userid [ INTEGER ] primary_key age [ TEXT ] u_gender [ TEXT ] occupation [ TEXT ] movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: How many separate 35 year-old uesers have rated the movie from UK? [/INST]
SELECT COUNT(DISTINCT T2.userid) FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid INNER JOIN users AS T3 ON T2.userid = T3.userid WHERE T1.country = 'UK' AND T3.age = 35;
[INST] Here is a database schema: users : userid [ INTEGER ] primary_key age [ TEXT ] u_gender [ TEXT ] occupation [ TEXT ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: List the user ids and ages who gave the rate 2 to the movie No. 2409051. [/INST]
SELECT T1.userid, T1.age FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid WHERE T2.movieid = '2409051' AND T2.rating = 2;
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: Please give the ids of the oldest films that got the most ratings. [/INST]
SELECT DISTINCT T1.movieid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T1.rating = 5 AND T2.year = 1;
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: Which different movies from France got the least ratings? [/INST]
SELECT DISTINCT T1.movieid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'France' AND T1.rating = 1;
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2actors : movieid [ INTEGER ] actorid [ INTEGER ] cast_num [ INTEGER ] Please write me a SQL statement that answers the following question: How many female actors have been played a role in any of French or USA movies? [/INST]
SELECT COUNT(T2.actorid) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.country IN ('France', 'USA');
[INST] Here is a database schema: movies2actors : movieid [ INTEGER ] actorid [ INTEGER ] cast_num [ INTEGER ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: How many different actors have played a role in the highest rating movie? [/INST]
SELECT COUNT(DISTINCT T2.actorid) FROM u2base AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.rating = 5;
[INST] Here is a database schema: movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: Which Crime film got the lowest average rating? [/INST]
SELECT T2.movieid FROM u2base AS T2 INNER JOIN movies2directors AS T3 ON T2.movieid = T3.movieid WHERE T3.genre = 'Crime' GROUP BY T2.movieid ORDER BY AVG(T2.rating) LIMIT 1;
[INST] Here is a database schema: actors : actorid [ INTEGER ] primary_key a_gender [ TEXT ] a_quality [ INTEGER ] movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2actors : movieid [ INTEGER ] actorid [ INTEGER ] cast_num [ INTEGER ] Please write me a SQL statement that answers the following question: What's the ratio of gender in actors to actress in all the UK movies? [/INST]
SELECT CAST(SUM(IIF(T3.a_gender = 'M', 1, 0)) AS REAL) / SUM(IIF(T3.a_gender = 'F', 1, 0)) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T2.actorid = T3.actorid WHERE T1.country = 'UK';
[INST] Here is a database schema: users : userid [ INTEGER ] primary_key age [ TEXT ] u_gender [ TEXT ] occupation [ TEXT ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: How many 35-year-old female users gave the movie 1711133 a rating of 3? [/INST]
SELECT COUNT(T1.userid) FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid WHERE T2.rating = 3 AND T2.movieid = '1711133' AND T1.age = 35 AND T1.u_gender = 'F';
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: How many users have rated 1 each for the UK's second newest movies with a running time of 2? [/INST]
SELECT COUNT(T2.userid) FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'UK' AND T1.runningtime = 2 AND T2.rating = 1 AND T1.year = 2;
[INST] Here is a database schema: directors : directorid [ INTEGER ] primary_key d_quality [ INTEGER ] avg_revenue [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: How many unique directors with an average earnings of 2 and a quality of 3 have not made comedy films? List them. [/INST]
SELECT DISTINCT T1.directorid FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 3 AND T1.avg_revenue = 2 AND T2.genre != 'Comedy';
[INST] Here is a database schema: actors : actorid [ INTEGER ] primary_key a_gender [ TEXT ] a_quality [ INTEGER ] movies2actors : movieid [ INTEGER ] actorid [ INTEGER ] cast_num [ INTEGER ] Please write me a SQL statement that answers the following question: Calculate the percentage of female actors and quality 2 who have appeared twice at the casting of the film 1672580. [/INST]
SELECT CAST(SUM(IIF(T2.cast_num = 2 AND T1.a_quality = 2, 1, 0)) AS REAL) * 100 / COUNT(T1.actorid) FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid WHERE T2.movieid = 1672580 AND T1.a_gender = 'F';
[INST] Here is a database schema: actors : actorid [ INTEGER ] primary_key a_gender [ TEXT ] a_quality [ INTEGER ] Please write me a SQL statement that answers the following question: How many of the worst actors are men and how many of the worst actors are women? Indicate your answer in ratio form. [/INST]
SELECT CAST(SUM(IIF(a_gender = 'M', 1, 0)) AS REAL) / SUM(IIF(a_gender = 'F', 1, 0)) FROM actors WHERE a_quality = 0;
[INST] Here is a database schema: movies2actors : movieid [ INTEGER ] actorid [ INTEGER ] cast_num [ INTEGER ] Please write me a SQL statement that answers the following question: Which actor has appeared in the most films? [/INST]
SELECT actorid FROM movies2actors GROUP BY actorid ORDER BY COUNT(movieid) DESC LIMIT 1;
[INST] Here is a database schema: movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: What is the most popular genre of film directed by directors? [/INST]
SELECT genre FROM movies2directors GROUP BY genre ORDER BY COUNT(movieid) DESC LIMIT 1;
[INST] Here is a database schema: directors : directorid [ INTEGER ] primary_key d_quality [ INTEGER ] avg_revenue [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: What are the most common film genres made by the worst directors? [/INST]
SELECT T2.genre FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 0 GROUP BY T2.genre ORDER BY COUNT(T2.movieid) DESC LIMIT 1;
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: What non-English American film/s has received the lowest user ratings? Mention the movie's I.D. [/INST]
SELECT T2.movieid FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid WHERE T1.isEnglish = 'F' AND T1.country = 'USA' ORDER BY T2.rating LIMIT 1;
[INST] Here is a database schema: directors : directorid [ INTEGER ] primary_key d_quality [ INTEGER ] avg_revenue [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: What is the total average movie directed by the directors who's quality and revenue is 4? [/INST]
SELECT CAST(SUM(CASE WHEN T1.d_quality = 4 AND T1.avg_revenue = 4 THEN 1 ELSE 0 END) AS REAL) / COUNT(T2.movieid) FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid;
[INST] Here is a database schema: users : userid [ INTEGER ] primary_key age [ TEXT ] u_gender [ TEXT ] occupation [ TEXT ] movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: Which movies have received the greatest ratings from female users whose occupations fall within the category of 3? [/INST]
SELECT T2.movieid FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T1.u_gender = 'F' AND T1.occupation = 3 AND T2.rating = 5;
[INST] Here is a database schema: actors : actorid [ INTEGER ] primary_key a_gender [ TEXT ] a_quality [ INTEGER ] movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2actors : movieid [ INTEGER ] actorid [ INTEGER ] cast_num [ INTEGER ] Please write me a SQL statement that answers the following question: How many female actresses appeared in the movie 2312852, what country was it in, and what was it's running time? [/INST]
SELECT SUM(IIF(T1.a_gender = 'F', 1, 0)) , T3.country, T3.runningtime FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T2.movieid = 2312852 GROUP BY T3.country, T3.runningtime;
[INST] Here is a database schema: directors : directorid [ INTEGER ] primary_key d_quality [ INTEGER ] avg_revenue [ INTEGER ] movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: How many horror movies were made by the worst directors? [/INST]
SELECT COUNT(T1.movieid) FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid INNER JOIN directors AS T3 ON T1.directorid = T3.directorid WHERE T1.genre = 'horror' AND T3.d_quality = 0;
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: What are the genres of all the English-language foreign films having a runtime of two hours or less? List each one. [/INST]
SELECT T2.genre FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.runningtime <= 2 AND T1.isEnglish = 'T' AND T1.country = 'other';
[INST] Here is a database schema: users : userid [ INTEGER ] primary_key age [ TEXT ] u_gender [ TEXT ] occupation [ TEXT ] movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] u2base : userid [ INTEGER ] movieid [ INTEGER ] rating [ TEXT ] Please write me a SQL statement that answers the following question: Among the English comedy movies produced in the UK, how many movies with a running time of 3 was rated the highest by users between the age 45-50? Indicate the movie names. [/INST]
SELECT DISTINCT T1.movieid FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid INNER JOIN u2base AS T3 ON T1.movieid = T3.movieid INNER JOIN users AS T4 ON T3.userid = T4.userid WHERE T1.country = 'UK' AND T2.genre = 'Comedy' AND T1.runningtime = 3 AND T3.rating = 5 AND T4.age BETWEEN 45 AND 50 AND T1.isEnglish = 'T';
[INST] Here is a database schema: movies : movieid [ INTEGER ] primary_key year [ INTEGER ] isEnglish [ TEXT ] country [ TEXT ] runningtime [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: What is the percentage difference of English and non-English-language crime movies in other countries in year 3? [/INST]
SELECT CAST(SUM(IIF(T1.isEnglish = 'T', 1, 0)) - SUM(IIF(T1.isEnglish = 'F', 1, 0)) AS REAL) * 100 / COUNT(T1.movieid) FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'other' AND T1.year = 3;
[INST] Here is a database schema: actors : actorid [ INTEGER ] primary_key a_gender [ TEXT ] a_quality [ INTEGER ] movies2actors : movieid [ INTEGER ] actorid [ INTEGER ] cast_num [ INTEGER ] movies2directors : movieid [ INTEGER ] directorid [ INTEGER ] genre [ TEXT ] Please write me a SQL statement that answers the following question: What is the total amount male and female actors who were casted in movie ID 1684910 and what is the proportion between the highest quality actors against the worst quality of actors? Indicate your answer in percentage. List the the director as well as the genre. [/INST]
SELECT SUM(IIF(a_gender = 'M', 1, 0)) , SUM(IIF(a_gender = 'F', 1, 0)) , CAST(SUM(IIF(a_quality = 5, 1, 0)) AS REAL) * 100 / COUNT(*) , CAST(SUM(IIF(a_quality = 0, 1, 0)) AS REAL) * 100 / COUNT(*), ( SELECT directorid FROM movies2directors WHERE movieid = 1684910 ) , ( SELECT genre FROM movies2directors WHERE movieid = 1684910 ) FROM actors WHERE actorid IN ( SELECT actorid FROM movies2actors WHERE movieid = 1684910 );
[INST] Here is a database schema: people : Customer ID [ TEXT ] Customer Name [ TEXT ] Segment [ TEXT ] Country [ TEXT ] City [ TEXT ] State [ TEXT ] Postal Code [ INTEGER ] Region [ TEXT ] Please write me a SQL statement that answers the following question: What is the ratio between customers who live in Texas and customers who live in Indiana? [/INST]
SELECT CAST(SUM(CASE WHEN State = 'Texas' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN State = 'Indiana' THEN 1 ELSE 0 END) FROM people;
[INST] Here is a database schema: officers : case_number [ TEXT ] officers.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: Among all the male officers, what is the percentage of them are White? [/INST]
SELECT CAST(SUM(IIF(race = 'W', 1, 0)) AS REAL) * 100 / COUNT(case_number) FROM officers WHERE gender = 'M';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] Please write me a SQL statement that answers the following question: What is the percentage of the cases involved more than 3 officers from year 2010 to 2015? [/INST]
SELECT CAST(SUM(IIF(officer_count > 3, 1, 0)) AS REAL) * 100 / COUNT(case_number) FROM incidents WHERE STRFTIME('%Y', date) BETWEEN '2010' AND '2015';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] Please write me a SQL statement that answers the following question: In which year has the greatest number of cases where Handgun was used as weapon? [/INST]
SELECT STRFTIME('%Y', date) FROM incidents WHERE subject_weapon = 'Handgun' GROUP BY STRFTIME('%Y', date) ORDER BY COUNT(case_number) DESC LIMIT 1;
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] Please write me a SQL statement that answers the following question: Among the cases dismissed by the grand jury disposition, what percentage of cases is where the subject is injured? [/INST]
SELECT CAST(SUM(subject_statuses = 'Injured') AS REAL) * 100 / COUNT(case_number) FROM incidents WHERE grand_jury_disposition = 'No Bill';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] Please write me a SQL statement that answers the following question: Did the number of cases with Vehicle as subject weapon increase or decrease from year 2007 to 2008. State the difference. [/INST]
SELECT SUM(IIF(STRFTIME('%Y', date) = '2007', 1, 0)) - SUM(IIF(STRFTIME('%Y', date) = '2008', 1, 0)) FROM incidents WHERE subject_weapon = 'Vehicle';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] Please write me a SQL statement that answers the following question: Among the 'Handgun' weapon used by subject, how many percent were 'Shoot and Miss'? [/INST]
SELECT CAST(SUM(subject_statuses = 'Shoot and Miss') AS REAL) * 100 / COUNT(case_number) FROM incidents WHERE subject_weapon = 'Handgun';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] officers : case_number [ TEXT ] officers.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: Who are the officers involved in cases that are voted as 'No Bill'. List their last name and gender. [/INST]
SELECT T2.last_name, T2.gender FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number WHERE T1.grand_jury_disposition = 'No Bill';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] subjects : case_number [ TEXT ] subjects.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: Which are the cases where the subject are female. List the case number, subject status and weapon. [/INST]
SELECT T1.case_number, T1.subject_statuses, T1.subject_weapon FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T2.gender = 'F';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] subjects : case_number [ TEXT ] subjects.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: From the cases where the subject are male, list the case number and the location and subject status. [/INST]
SELECT T1.case_number, T1.location, T1.subject_statuses FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T2.gender = 'M';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] officers : case_number [ TEXT ] officers.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: For case(s) where officer 'Evenden, George' is in charged, state the case number and the grand jury disposition? [/INST]
SELECT T1.case_number, T1.grand_jury_disposition FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number WHERE T2.first_name = 'George' AND T2.last_name = 'Evenden';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] officers : case_number [ TEXT ] officers.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: For case number '134472-2015', list the last name of the officers involved and state the subject statuses. [/INST]
SELECT T2.last_name, T1.subject_statuses FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number WHERE T1.case_number = '134472-2015';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] subjects : case_number [ TEXT ] subjects.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: From the cases where the subject were deceased, list the subject's last name, gender, race and case number. [/INST]
SELECT T2.last_name, T2.gender, T2.race, T2.case_number FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T1.subject_statuses = 'Deceased';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] subjects : case_number [ TEXT ] subjects.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: What is the percentage of subject who are female used the Vehicle as weapon? [/INST]
SELECT CAST(SUM(T1.subject_weapon = 'Vehicle') AS REAL) * 100 / COUNT(T1.case_number) FROM incidents T1 INNER JOIN subjects T2 ON T1.case_number = T2.case_number WHERE T2.gender = 'F';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] subjects : case_number [ TEXT ] subjects.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: From the 'Injured' statuses of the subject, what is the ratio of weapons used are knife against handgun? [/INST]
SELECT CAST(SUM(T1.subject_weapon = 'Knife') AS REAL) * 100 / SUM(T1.subject_weapon = 'Handgun') FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T1.subject_statuses = 'Injured';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] Please write me a SQL statement that answers the following question: List all cases from the year 2012 in which the subject was deceased [/INST]
SELECT case_number FROM incidents WHERE STRFTIME('%Y', date) > '2011' AND subject_statuses = 'Deceased';
[INST] Here is a database schema: officers : case_number [ TEXT ] officers.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: Of all male officers, what percentage are black officers? [/INST]
SELECT CAST(SUM(race = 'B') AS REAL) * 100 / COUNT(case_number) FROM officers WHERE gender = 'M';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] officers : case_number [ TEXT ] officers.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: How many incidents in which the subject's weapon was a vehicle were investigated by a female officer? [/INST]
SELECT COUNT(T1.case_number) FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number WHERE T1.subject_weapon = 'Vehicle' AND T2.gender = 'F';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] subjects : case_number [ TEXT ] subjects.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: In how many cases where the subject was a female was the subject's status listed as Deceased? [/INST]
SELECT COUNT(T1.case_number) FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T2.gender = 'F' AND T1.subject_statuses = 'Deceased';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] officers : case_number [ TEXT ] officers.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: Of the black officers, how many of them investigated cases between the years 2010 and 2015? [/INST]
SELECT COUNT(T1.case_number) FROM officers AS T1 INNER JOIN incidents AS T2 ON T2.case_number = T1.case_number WHERE T1.race = 'B' AND T2.date BETWEEN '2010-01-01' AND '2015-12-31';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] Please write me a SQL statement that answers the following question: How many instances were found in June 2015? [/INST]
SELECT COUNT(case_number) FROM incidents WHERE date BETWEEN '2015-06-01' AND '2015-06-30';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] Please write me a SQL statement that answers the following question: How many people were injured between 2006 and 2014 as a result of a handgun? [/INST]
SELECT COUNT(location) FROM incidents WHERE subject_weapon = 'Handgun' AND subject_statuses = 'Injured' AND date BETWEEN '2006-01-01' AND '2013-12-31';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] Please write me a SQL statement that answers the following question: What is the most common type of weapon that causes death? [/INST]
SELECT subject_weapon FROM incidents WHERE subject_statuses = 'Deceased' GROUP BY subject_weapon ORDER BY COUNT(case_number) DESC LIMIT 1;
[INST] Here is a database schema: officers : case_number [ TEXT ] officers.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: What is the proportion of white males and females in the police force? [/INST]
SELECT CAST(SUM(gender = 'M') AS REAL) / SUM(gender = 'F') FROM officers WHERE race = 'W';
[INST] Here is a database schema: subjects : case_number [ TEXT ] subjects.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: How many more black female victims than white female victims were discovered? [/INST]
SELECT SUM(race = 'B') - SUM(race = 'W') FROM subjects WHERE gender = 'F';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] Please write me a SQL statement that answers the following question: What percentage of deaths were caused by rifles? [/INST]
SELECT CAST(SUM(subject_statuses = 'Deceased') AS REAL) * 100 / COUNT(case_number) FROM incidents WHERE subject_weapon = 'Rifle';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] subjects : case_number [ TEXT ] subjects.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: Which type of weapon was used to attack the victim in the record number 031347-2015? What is the victim's race and gender? [/INST]
SELECT T1.subject_weapon, T2.race, T2.gender FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T1.case_number = '031347-2015';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] officers : case_number [ TEXT ] officers.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] subjects : case_number [ TEXT ] subjects.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: Which near-death incident did a policeman by the name of Ruben Fredirick look into? What is the victim in this incident's race and gender? [/INST]
SELECT T1.case_number, T3.race, T3.gender FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number INNER JOIN subjects AS T3 ON T1.case_number = T3.case_number WHERE T2.first_name = 'Fredirick' AND T2.last_name = 'Ruben';
[INST] Here is a database schema: incidents : case_number [ TEXT ] primary_key date [ DATE ] location [ TEXT ] subject_statuses [ TEXT ] subject_weapon [ TEXT ] subjects [ TEXT ] subject_count [ INTEGER ] officers [ TEXT ] officers : case_number [ TEXT ] officers.case_number = incidents.case_number race [ TEXT ] gender [ TEXT ] last_name [ TEXT ] first_name [ TEXT ] full_name [ TEXT ] Please write me a SQL statement that answers the following question: What proportion of male police officers looked into events where people were injured? [/INST]
SELECT CAST(SUM(T2.gender = 'M') AS REAL) * 100 / COUNT(T1.case_number) FROM incidents T1 INNER JOIN officers T2 ON T1.case_number = T2.case_number WHERE T1.subject_statuses = 'Injured';
[INST] Here is a database schema: Classification : GeneID [ TEXT ] primary_key Localization [ TEXT ] Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Please write me a SQL statement that answers the following question: For the genes that are located in the plasma membrane, please list their number of chromosomes. [/INST]
SELECT T1.Chromosome FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'plasma membrane';
[INST] Here is a database schema: Classification : GeneID [ TEXT ] primary_key Localization [ TEXT ] Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Please write me a SQL statement that answers the following question: How many non-essential genes are located in the nucleus? [/INST]
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'nucleus' AND T1.Essential = 'Non-Essential';
[INST] Here is a database schema: Classification : GeneID [ TEXT ] primary_key Localization [ TEXT ] Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Please write me a SQL statement that answers the following question: Among the genes with nucleic acid metabolism defects, how many of them can be found in the vacuole? [/INST]
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'vacuole' AND T1.Phenotype = 'Nucleic acid metabolism defects';
[INST] Here is a database schema: Classification : GeneID [ TEXT ] primary_key Localization [ TEXT ] Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Please write me a SQL statement that answers the following question: Please list the location of the genes that have the most chromosomes. [/INST]
SELECT T2.Localization FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID ORDER BY T1.Chromosome DESC LIMIT 1;
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: Among the pairs of genes that are both located in the nucleus, what is the highest expression correlation score? [/INST]
SELECT T2.Expression_Corr FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 INNER JOIN Genes AS T3 ON T3.GeneID = T2.GeneID2 WHERE T1.Localization = 'nucleus' AND T3.Localization = 'nucleus' ORDER BY T2.Expression_Corr DESC LIMIT 1;
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: What are the functions of the pair of genes that have the lowest expression correlation score?a [/INST]
SELECT T1.Function FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 ORDER BY T2.Expression_Corr ASC LIMIT 1;
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: Among the pairs of genes that are not from the class of motorproteins, how many of them are negatively correlated? [/INST]
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 AND T1.Class = 'Motorproteins';
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: For the pairs of genes with one having 8 chromosomes and the other having 6 chromosomes, what is the highest expression correlation score? [/INST]
SELECT T2.Expression_Corr FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Chromosome = 6 OR T1.Chromosome = 8 ORDER BY T2.Expression_Corr DESC LIMIT 1;
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: Please list the motif of the genes that are located in the cytoplasm and have 7 chromosomes. [/INST]
SELECT T2.GeneID1, T2.GeneID2 FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization = 'cytoplasm' AND T1.Chromosome = 7;
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: For the non-essential genes whose functions are transcription, how many of them are not located in the cytoplasm? [/INST]
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization != 'cytoplasm' AND T1.Function = 'TRANSCRIPTION' AND T1.Essential = 'NON-Essential';
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: How many pairs of positively correlated genes are both non-essential? [/INST]
SELECT COUNT(T2.GeneID2) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr > 0 AND T1.Essential = 'Non-Essential';
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: If a pair of genes is positively correlated, what is the possibility of it being composed of two genes both with over 10 chromosomes? [/INST]
SELECT CAST(SUM(IIF(T1.Chromosome > 10 AND T3.Chromosome > 10, 1, 0)) AS REAL) * 100 / COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 INNER JOIN Genes AS T3 ON T3.GeneID = T2.GeneID2 WHERE T2.Expression_Corr > 0;
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: For the pairs of genes both from the class ATPases, what is the average expression correlation score? [/INST]
SELECT AVG(T2.Expression_Corr) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Class = 'ATPases';
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Please write me a SQL statement that answers the following question: Lists all genes by identifier number located in the cytoplasm and whose function is metabolism. [/INST]
SELECT DISTINCT GeneID FROM Genes WHERE Localization = 'cytoplasm' AND Function = 'METABOLISM';
[INST] Here is a database schema: Classification : GeneID [ TEXT ] primary_key Localization [ TEXT ] Please write me a SQL statement that answers the following question: How many different genes do we have if we add those located in the plasma and in the nucleus? [/INST]
SELECT COUNT(GeneID) FROM Classification WHERE Localization IN ('plasma', 'nucleus');
[INST] Here is a database schema: Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: What kind of expression correlation occurs in physical type interacting gene pairs and what percentage of these are negatively correlated? [/INST]
SELECT Expression_Corr FROM Interactions WHERE Type = 'Physical' UNION ALL SELECT CAST(SUM(Expression_Corr < 0) AS REAL) * 100 / COUNT(*) FROM Interactions WHERE Type = 'Physical';
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Please write me a SQL statement that answers the following question: What percentage of genes located in the cytoskeleton are of unknown class? And of these, how many are not conditional phenotypes? [/INST]
SELECT SUM(Localization = 'cytoskeleton' AND Phenotype = 'Conditional phenotypes') , CAST(SUM(Localization = 'cytoskeleton') AS REAL) * 100 / COUNT(GeneID) FROM Genes;
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: What type of interactions occurs in genes whose function is cellular transport and transport medicine and are classified as non-essential? [/INST]
SELECT T2.Type FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Function = 'TRANSCRIPTION' AND T1.Essential = 'Non-Essential';
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: List all genes whose interaction is with genes located in the nucleus in which it is positively correlated. [/INST]
SELECT T1.GeneID FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr > 0 AND T1.Localization = 'nucleus';
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: Taking all the essential genes of the transcription factors class located in the nucleus as a reference, how many of them carry out a genetic-type interaction with another gene? List them. [/INST]
SELECT T2.GeneID1 FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization = 'nucleus' AND T1.Class = 'Transcription factors' AND T1.Essential = 'Essential' AND T2.Expression_Corr != 0;
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: Of all the nonessential genes that are not of the motorprotein class and whose phenotype is cell cycle defects, how many do not have a physical type of interaction? [/INST]
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Type != 'Physical' AND T1.Phenotype = 'Cell cycle defects' AND T1.Class != 'Motorproteins' AND T1.Essential = 'Non-Essential';
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: Of the genes whose phenotype and motif are nucleic acid metabolism defects, PS00107, what percentage perform positive interaction with another gene? [/INST]
SELECT CAST(SUM(IIF(T2.Expression_Corr > 0, 1, 0)) AS REAL) * 100 / COUNT(T2.GeneID1) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Phenotype = 'Nucleic acid metabolism defects' AND T1.Motif = 'PS00107';
[INST] Here is a database schema: Genes : GeneID [ TEXT ] Genes.GeneID = Classification.GeneID Essential [ TEXT ] Class [ TEXT ] Complex [ TEXT ] Phenotype [ TEXT ] Motif [ TEXT ] Chromosome [ INTEGER ] Function [ TEXT ] Localization [ TEXT ] Interactions : GeneID1 [ TEXT ] Interactions.GeneID1 = Classification.GeneID GeneID2 [ TEXT ] Interactions.GeneID2 = Classification.GeneID Type [ TEXT ] Expression_Corr [ REAL ] Please write me a SQL statement that answers the following question: Which negatively correlated, genetically interacting genes are non-essential? What percentage do they represent with respect to those that are essential? [/INST]
SELECT CAST(COUNT(T1.GeneID) AS REAL) * 100 / ( SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 ) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 AND T1.Essential = 'Non-Essential';
[INST] Here is a database schema: playstore : App [ TEXT ] Category [ TEXT ] Rating [ REAL ] Reviews [ INTEGER ] Size [ TEXT ] Installs [ TEXT ] Type [ TEXT ] Price [ TEXT ] Content Rating [ TEXT ] Genres [ TEXT ] user_reviews : App [ TEXT ] user_reviews.App = playstore.App Translated_Review [ TEXT ] Sentiment [ TEXT ] Sentiment_Polarity [ TEXT ] Sentiment_Subjectivity [ TEXT ] Please write me a SQL statement that answers the following question: How many users mildly likes the 7 Minute Workout app and when was it last updated? [/INST]
SELECT COUNT(T2.Sentiment_Polarity), T1."Last Updated" FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = '7 Minute Workout' AND T2.Sentiment_Polarity BETWEEN 0 AND 0.5;
[INST] Here is a database schema: playstore : App [ TEXT ] Category [ TEXT ] Rating [ REAL ] Reviews [ INTEGER ] Size [ TEXT ] Installs [ TEXT ] Type [ TEXT ] Price [ TEXT ] Content Rating [ TEXT ] Genres [ TEXT ] user_reviews : App [ TEXT ] user_reviews.App = playstore.App Translated_Review [ TEXT ] Sentiment [ TEXT ] Sentiment_Polarity [ TEXT ] Sentiment_Subjectivity [ TEXT ] Please write me a SQL statement that answers the following question: How many users holds neutral attitude towards the HTC Weather app? Indicate the app's rating on the Google Play Store. [/INST]
SELECT COUNT(T1.Rating), T1.Rating FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'HTC Weather' AND T2.Sentiment = 'Neutral';
[INST] Here is a database schema: playstore : App [ TEXT ] Category [ TEXT ] Rating [ REAL ] Reviews [ INTEGER ] Size [ TEXT ] Installs [ TEXT ] Type [ TEXT ] Price [ TEXT ] Content Rating [ TEXT ] Genres [ TEXT ] user_reviews : App [ TEXT ] user_reviews.App = playstore.App Translated_Review [ TEXT ] Sentiment [ TEXT ] Sentiment_Polarity [ TEXT ] Sentiment_Subjectivity [ TEXT ] Please write me a SQL statement that answers the following question: What is the name and category of the app with the highest amount of -1 sentiment polarity score? [/INST]
SELECT DISTINCT T1.App, T1.Category FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment_Polarity = '-1.0';
[INST] Here is a database schema: playstore : App [ TEXT ] Category [ TEXT ] Rating [ REAL ] Reviews [ INTEGER ] Size [ TEXT ] Installs [ TEXT ] Type [ TEXT ] Price [ TEXT ] Content Rating [ TEXT ] Genres [ TEXT ] user_reviews : App [ TEXT ] user_reviews.App = playstore.App Translated_Review [ TEXT ] Sentiment [ TEXT ] Sentiment_Polarity [ TEXT ] Sentiment_Subjectivity [ TEXT ] Please write me a SQL statement that answers the following question: What is the average sentiment polarity score of the Cooking Fever app? Indicate the age group that the app is targeted at. [/INST]
SELECT AVG(T2.Sentiment_Polarity), T1."Content Rating" FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Cooking Fever';
[INST] Here is a database schema: playstore : App [ TEXT ] Category [ TEXT ] Rating [ REAL ] Reviews [ INTEGER ] Size [ TEXT ] Installs [ TEXT ] Type [ TEXT ] Price [ TEXT ] Content Rating [ TEXT ] Genres [ TEXT ] user_reviews : App [ TEXT ] user_reviews.App = playstore.App Translated_Review [ TEXT ] Sentiment [ TEXT ] Sentiment_Polarity [ TEXT ] Sentiment_Subjectivity [ TEXT ] Please write me a SQL statement that answers the following question: What is the lowest sentiment polarity score of the Basketball Stars app for people who dislikes the app pretty much and how many downloads does it have? [/INST]
SELECT MIN(T2.Sentiment_Polarity), T1.Installs FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Basketball Stars';
[INST] Here is a database schema: playstore : App [ TEXT ] Category [ TEXT ] Rating [ REAL ] Reviews [ INTEGER ] Size [ TEXT ] Installs [ TEXT ] Type [ TEXT ] Price [ TEXT ] Content Rating [ TEXT ] Genres [ TEXT ] user_reviews : App [ TEXT ] user_reviews.App = playstore.App Translated_Review [ TEXT ] Sentiment [ TEXT ] Sentiment_Polarity [ TEXT ] Sentiment_Subjectivity [ TEXT ] Please write me a SQL statement that answers the following question: For the Akinator app, how many reviews have sentiment subjectivity of no more than 0.5 and what is its current version? [/INST]
SELECT COUNT(T2.Sentiment_Subjectivity), T1."Current Ver" FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Akinator' AND T2.Sentiment_Subjectivity < 0.5;
[INST] Here is a database schema: playstore : App [ TEXT ] Category [ TEXT ] Rating [ REAL ] Reviews [ INTEGER ] Size [ TEXT ] Installs [ TEXT ] Type [ TEXT ] Price [ TEXT ] Content Rating [ TEXT ] Genres [ TEXT ] Please write me a SQL statement that answers the following question: How many apps have rating of 5? [/INST]
SELECT COUNT(App) FROM playstore WHERE Rating = 5;