db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
cs_semester
What is the difference in the average GPA of students who took the hardest and easiest courses?
difference in the average gpa = SUBTRACT(AVG(gpa WHERE MAX(diff)), AVG(gpa where min(diff))); difficulty of the course refers to diff; hardest course refers to MAX(diff); easiest course refers to MIN(diff);
SELECT AVG(T1.gpa) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.diff IN (2, 1) GROUP BY T3.diff
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
Which production company produced the movie that made the most money at the box office?
Which production company refers to company_name; most money at the box office refers to max(revenue)
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id GROUP BY T1.company_id ORDER BY SUM(T3.revenue) DESC LIMIT 1
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
How many active users were there in the event id 2?
active users refers to is_active = 1;
SELECT COUNT(is_active) FROM app_events WHERE event_id = 2 AND is_active = 1
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
Find the full name and popularity of the professor who advises the most number of students.
full name of the professor = first_name, last_name; most number of students refers to MAX(COUNT(student_id));
SELECT T1.first_name, T1.last_name, T1.popularity FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id GROUP BY T1.prof_id ORDER BY COUNT(T2.student_id) DESC LIMIT 1
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
How many movies did Universal Studios release?
Universal Studios refers to company_name = 'Universal Studios'
SELECT COUNT(T2.movie_id) FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id WHERE T1.company_name = 'Universal Studios'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
How many events were held at coordinate 97,40?
coordinate 97,40 refers to longitude = 97 AND latitude = 40;
SELECT COUNT(event_id) FROM `events` WHERE latitude = 40 AND longitude = 97
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
Give the full name and capability of students who failed in any courses.
full name of students = f_name, l_name; failed refers to grade IS NULL;
SELECT T2.f_name, T2.l_name, T1.capability FROM RA AS T1 INNER JOIN student AS T2 ON T2.student_id = T1.student_id INNER JOIN registration AS T3 ON T2.student_id = T3.student_id WHERE T3.grade IS NULL OR T3.grade = ''
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
talkingdata
How many female users over the age of 50 are there?
female refers to gender = 'F'; over the age of 50 refers to age > 50;
SELECT COUNT(gender) FROM gender_age WHERE age > 50 AND gender = 'F'
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
movies_4
What is the name of the production company that made the most movies?
name of the production company refers to company_name; most movies refers to max(count(company_name))
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id ORDER BY COUNT(T2.movie_id) DESC LIMIT 1
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
computer_student
How many courses were taught by a professor who is currently the member of faculty?
professor refers to professor = 1;  member of faculty refers to hasPosition <> 0
SELECT COUNT(*) FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 AND T1.hasPosition <> 0
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
cs_semester
Calculate the difference between the average satisfaction of the students with high salaries and no salary.
average satisfaction difference = SUBTRACT(AVG(sat where salary = 'high')), (AVG(sat where salary = 'free')); satisfaction refers to sat; no salary refers to salary = 'free';
SELECT AVG(T2.sat) - ( SELECT AVG(T2.sat) FROM RA AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'free' ) AS diff FROM RA AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id WHERE T1.salary = 'high'
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
Who played Captain Jack Sparrow in all of the Pirates of the Caribbean movies?
Captain Jack Sparrow refers to character_name = 'Captain Jack Sparrow'; Pirates of the Caribbean movies refers to title LIKE 'Pirates of the Carribbean%'
SELECT DISTINCT T3.person_name FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T2.character_name = 'Captain Jack Sparrow' AND T1.title LIKE 'Pirates of the Caribbean%'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
What is the device id of the oldest user?
oldest user refers to MAX(age);
SELECT device_id FROM gender_age WHERE age = ( SELECT MAX(age) FROM gender_age )
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
movies_4
Provide the title of the movie that is most-liked by a large number of people.
most-liked by a large number of people refers to max(popularity)
SELECT title FROM movie ORDER BY popularity DESC LIMIT 1
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
What is the name of the category which most users belong to?
most users belong to refers to MAX(COUNT(app_id)); name of category refers to category;
SELECT T.category FROM ( SELECT T2.category, COUNT(T1.app_id) AS num FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T2.label_id = T1.label_id GROUP BY T1.app_id, T2.category ) AS T ORDER BY T.num DESC LIMIT 1
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
Of the students with high salaries, how many took the computer vision course?
high salaries refers to salary = 'High';
SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN registration AS T2 ON T2.student_id = T1.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T1.salary = 'high' AND T3.name = 'Computer Vision'
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
Who is the person associated with the crew id 1325273?
Who is the person refers to person_name; crew id 1325273 refers to person_id = 1325273
SELECT person_name FROM person WHERE person_id = 1325273
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
How many male users are in the age group of M32-38?
male refers to gender = 'M'; age group refers to group; `group` = 'M32-38';
SELECT COUNT(gender) FROM gender_age WHERE gender = 'M' AND `group` = 'M32-38'
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
Among the professors with more than average teaching ability, list the full name and email address of the professors who advise two or more students.
more than average teaching ability refers to teachingability > AVG(teachingability); full_name of the professor = first_name, last_name; email address of the professor refers to email; advises two or more students refers to COUNT(student_id) > = 2;
SELECT T2.first_name, T2.last_name, T2.email FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T2.teachingability > ( SELECT AVG(teachingability) FROM prof ) GROUP BY T2.prof_id HAVING COUNT(T1.student_id) >= 2
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
cs_semester
Please give the name of the course in which most numbers of the students got an A. Also, list the full name of the students who got an A in this course.
most number of students got an A refers MAX(COUNT(student_id WHERE grade = 'A')); full name = f_name, l_name; got an A refers to grade = 'A';
SELECT T3.name, T2.f_name, T2.l_name FROM registration AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T1.course_id = T3.course_id WHERE T1.grade = 'A' GROUP BY T3.name ORDER BY COUNT(T1.student_id) DESC LIMIT 1
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
What is Walt Disney Pictures' most popular movie?
Walt Disney Pictures refers to company_name = 'Walt Disney Pictures'; most popular movie refers to max(popularity)
SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Walt Disney Pictures' ORDER BY T3.popularity DESC LIMIT 1
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
How many users are there in the Home Decoration category?
null
SELECT COUNT(T1.app_id) FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T2.label_id = T1.label_id WHERE T2.category = 'Home Decoration'
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
What is the first and last name of students with highest gpa?
first name refers of students refers to f_name; last name of students refers to l_name; highest gpa refers to MAX(gpa);
SELECT f_name, l_name FROM student WHERE gpa = ( SELECT MAX(gpa) FROM student )
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
talkingdata
What is the gender of the youngest user?
youngest user refers to MIN(age);
SELECT gender FROM gender_age WHERE age = ( SELECT MIN(age) FROM gender_age )
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
Find the university from which the professor who advised most undergraduate students graduated.
university from which the professor graduated refers to graduate_from; undergraduate students refers to type = 'UG';
SELECT T1.graduate_from FROM prof AS T1 INNER JOIN RA AS T2 ON T1.prof_id = T2.prof_id INNER JOIN student AS T3 ON T2.student_id = T3.student_id WHERE T3.type = 'UG' GROUP BY T1.prof_id ORDER BY COUNT(T2.student_id) DESC LIMIT 1
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
When was the first movie released?
when the first movie refers to release_date where min(release_date)
SELECT MIN(release_date) FROM movie WHERE movie_status = 'Released'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
What is the age of the oldest active user that participated in the event held on 5/6/2016 at coordinates 121, 31?
oldest user refers to MAX(age); active user refers to is_active = 1; on 5/6/2016 refers to timestamp LIKE '2016-05-06%'; coordinates 121, 31 refers to longitude = 121 AND latitude = 31;
SELECT T3.age FROM app_events AS T1 INNER JOIN events_relevant AS T2 ON T1.event_id = T2.event_id INNER JOIN gender_age AS T3 ON T2.device_id = T3.device_id WHERE T1.is_active = 1 AND T2.longitude = 121 AND T2.latitude = 31 AND SUBSTR(T2.timestamp, 1, 10) = '2016-05-06' ORDER BY T3.age DESC LIMIT 1
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
What is the salary range of the student with an email of [email protected]?
salary range refers to salary;
SELECT T1.salary FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T2.email = '[email protected]'
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
How many crew are named John Young?
null
SELECT COUNT(person_id) FROM person WHERE person_name = 'John Young'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
What is the model of the oldest user's device?
model of the device refers to device_model; oldest user refers to MAX(age);
SELECT T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id ORDER BY T2.age DESC LIMIT 1
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
talkingdata
How many female users use ZenFone 5 devices?
female refers to gender = 'F'; ZenFone 5 refers to device_model = 'ZenFone 5';
SELECT COUNT(T1.gender) FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T2.device_id = T1.device_id WHERE T1.gender = 'F' AND T2.device_model = 'ZenFone 5'
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
What percentage of students are highly satisfied with the Intro to Database 2 course?
percentage = MULTIPLY(DIVIDE(COUNT(MAX(sat)), (COUNT(student_id))), 1.0); highly satisfied refers to MAX(sat);
SELECT CAST(( SELECT COUNT(*) FROM course WHERE name = 'Intro to Database 2' AND course_id IN ( SELECT course_id FROM registration WHERE sat = ( SELECT MAX(sat) FROM registration ) ) ) AS REAL) * 100 / COUNT(T1.student_id) FROM registration AS T1 INNER JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.name = 'Intro to Database 2'
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
What is the title of the movie that was made with the most money and resources?
made with the most money and resources refers to max(budget)
SELECT title FROM movie ORDER BY budget DESC LIMIT 1
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
cs_semester
Among courses with difficulty of 3, how many students have intellegence level of 2?
difficulty of 3 refers to diff = 3; intelligence = 2
SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.diff = 3 AND T1.intelligence = 2
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
How many movies have made at least 1 Billion at the box office?
have made at least 1 Billion at the box office refers to revenue > 1000000000
SELECT COUNT(movie_id) FROM movie WHERE revenue > 1000000000
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
What is the most common device model among female users between the ages 27 to 28?
most common device model refers to MAX(COUNT(device_id)); female refers to gender = 'F'; between the ages 27 to 28 refers to group = 'F27-28';
SELECT T2.device_model FROM gender_age AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T1.device_id = T2.device_id WHERE T1.`group` = 'F27-28' AND T1.gender = 'F' ORDER BY T2.device_id DESC LIMIT 1
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
Among professors with the highest teachability, how many of their students have high salary?
highest teachability refers to MAX(teachability); high salary refers to salary = 'high';
SELECT COUNT(T1.student_id) FROM RA AS T1 INNER JOIN prof AS T2 ON T1.prof_id = T2.prof_id WHERE T1.salary = 'high' ORDER BY T2.teachingability DESC LIMIT 1
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
Calculate the average budget of the movies directed by Jaume Collet-Serra.
directed by refers to job = 'Director'; average budget = AVG(budget)
SELECT CAST(SUM(T1.budget) AS REAL) / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Jaume Collet-Serra' AND T2.job = 'Director'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
How many male users are active in the events held on 5/1/2016?
male refers to gender = 'M'; active refers to is_active = 1; on 5/1/2016 refers to timestamp LIKE '2016-05-01%';
SELECT COUNT(T3.gender) FROM app_events AS T1 INNER JOIN events_relevant AS T2 ON T2.event_id = T1.event_id INNER JOIN gender_age AS T3 ON T3.device_id = T2.device_id WHERE T1.is_active = 1 AND T3.gender = 'M' AND T2.timestamp LIKE '2016-05-01%'
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
Among research postgraduate students, give the name of the course with the student satisfaction value of 1.
research postgraduate students refers to type = 'RPG'; name of the course refers to name; satisfaction refers to sat; sat = 1;
SELECT T3.name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T2.sat = 1 AND T1.type = 'RPG'
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
What is the percentage of male characters in the movie "Bride Wars"?
male refers to gender = 'Male'; "Bride Wars" refers to title = 'Bride Wars'; percentage = divide(sum(gender = 'Male'), count(gender)) * 100 as percentage
SELECT CAST(COUNT(CASE WHEN T3.gender = 'Male' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T3.gender) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Bride Wars'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
How many events were there on 30th April, 2016?
on 30th April, 2016 refers to `timestamp` LIKE '2016-04-30%';
SELECT COUNT(event_id) FROM events WHERE SUBSTR(`timestamp`, 1, 10) = '2016-04-30'
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
Among students that gave satisfaction of value 4 for the course named "Statistical Learning", how many of them have a gpa of 3.8?
satisfaction refers to sat; sat = 4; gpa = 3.8
SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Statistical learning' AND T2.sat = 4 AND T1.gpa = 3.8
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
For the movie "Reign of Fire", which department was Marcia Ross in?
movie "Reign of Fire" refers to title = 'Reign of Fire'; which department refers to department_name
SELECT T4.department_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id INNER JOIN department AS T4 ON T2.department_id = T4.department_id WHERE T3.person_name = 'Marcia Ross' AND T1.title = 'Reign of Fire'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
What is the gender of the majority of Vivo phone users?
majority of Vivo phone users refers to MAX(COUNT(phone_brand = 'vivo'));
SELECT T.gender FROM ( SELECT T2.gender, COUNT(T2.gender) AS num FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.phone_brand = 'vivo' GROUP BY T2.gender ) AS T ORDER BY T.num DESC LIMIT 1
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
movies_4
What is the production company of the movie "Crazy Heart"?
movie "Crazy Heart" refers to title = 'Crazy Heart'; production company refers to company_name
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T3.title = 'Crazy Heart'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
computer_student
Which member of the faculty are teaching the most courses and what is his/her general course level?
member of the faculty refers to hasPosition <> 0, most courses refers to max(count(course.course_id))
SELECT T1.p_id, T3.courseLevel FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T2.course_id GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
computer_student
What is the average number of students for each advisor?
students refers to advisedBy.p_id; advisor refers to p_id_dummy; average number = avg(count(advisedBy.p_id))
SELECT CAST(COUNT(p_id) AS REAL) / COUNT(DISTINCT p_id_dummy) AS avgnum FROM advisedBy GROUP BY p_id_dummy
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
movies_4
Give the number of movies with "saving the world" as the keyword.
"saving the world" as the keyword refers to keyword_name = 'saving the world'
SELECT COUNT(T2.movie_id) FROM keyword AS T1 INNER JOIN movie_keywords AS T2 ON T1.keyword_id = T2.keyword_id WHERE keyword_name = 'saving the world'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
What is the percentage of female OPPO users against the male OPPO users?
percentage = DIVIDE(MULTIPLY(CONCAT(COUNT(device_id WHERE phone_brand = 'OPPO' AND gender = 'F'), 100), COUNT(device_id)), '%') AS 'the percentage of female OPPO users'; DIVIDE(MULTIPLY(CONCAT(COUNT(device_id WHERE phone_brand = 'OPPO' AND gender = 'M'), 100), COUNT(device_id)), '%') AS 'the percentage of male OPPO users';
SELECT SUM(IIF(T2.gender = 'F', 1, 0)) * 100 / COUNT(T2.device_id) AS perFemale , SUM(IIF(T2.gender = 'M', 1, 0)) * 100 / COUNT(T2.device_id) AS perMale FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.phone_brand = 'OPPO'
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
movies_4
Provide the most used keyword in the movies.
most used keyword refers to keyword_name where max(count(keyword_name))
SELECT T1.keyword_name FROM keyword AS T1 INNER JOIN movie_keywords AS T2 ON T1.keyword_id = T2.keyword_id GROUP BY T1.keyword_name ORDER BY COUNT(T1.keyword_name) DESC LIMIT 1
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
What are the categories of the top 2 oldest events?
oldest event refers to MIN(timestamp);
SELECT T4.category FROM events_relevant AS T1 INNER JOIN app_events_relevant AS T2 ON T1.event_id = T2.event_id INNER JOIN app_labels AS T3 ON T3.app_id = T2.app_id INNER JOIN label_categories AS T4 ON T3.label_id = T4.label_id ORDER BY T1.timestamp LIMIT 2
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
List the student's first and last name that got a C in the course named "Applied Deep Learning".
student's first name refers to f_name; student's last name refers to l_name; got a C refers to grade = 'C';
SELECT T1.f_name, T1.l_name FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.name = 'Applied Deep Learning ' AND T2.grade = 'C'
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
How many producers does the movie "The Amityville Horror" have?
producers refers to job = 'Producer'; "The Amityville Horror" refers to title = 'The Amityville Horror'
SELECT COUNT(T2.person_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'The Amityville Horror' AND T2.job = 'Producer'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
How many users belong to the MOBA category?
null
SELECT COUNT(T2.app_id) FROM label_categories AS T1 INNER JOIN app_labels AS T2 ON T2.label_id = T1.label_id WHERE T1.category = 'MOBA'
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
computer_student
List all the course IDs for professional or master/graduate courses.
professional or master/graduate courses refers to courseLevel = 'Level_500'
SELECT course_id FROM course WHERE courseLevel = 'Level_500'
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
movies_4
For all the movies which were produced by Cruel and Unusual Films, which one has the most popularity?
produced by Cruel and Unusual Films refers to company_name = 'Cruel and Unusual Films'; most popularity refers to max(popularity)
SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Cruel and Unusual Films' ORDER BY T3.popularity DESC LIMIT 1
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
cs_semester
Among the students with a capability below 3, what is the difference of undergraduate students from research postgraduate students?
capability < 3; difference = subtract(count(type = 'UG')), (count(type = 'RPG')); undergraduate students refers to type = 'UG'; research postgraduate students refers to type = 'RPG';
SELECT SUM(CASE WHEN T2.type = 'UG' THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.type = 'RPG' THEN 1 ELSE 0 END) FROM RA AS T1 INNER JOIN student AS T2 ON T1.student_id = T2.student_id WHERE T1.capability < 3
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
Tell the number of movies made by Paramount Animation.
Paramount Animation refers to company_name = 'Paramount Animation'
SELECT COUNT(T2.movie_id) FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id WHERE T1.company_name = 'Paramount Animation'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
List the app users IDs and installed status for the event ID of 844.
app user IDs refers to app_id; is_installed = 1 means the app status is installed; is_installed = 0 means the app status is not installed;
SELECT app_id , IIF(is_installed = 1, 'YES', 'NO') AS status FROM app_events WHERE event_id = 844
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
computer_student
List the ID of all professors who are not faculty member along with the courses taught by him/her.
ID of all professors refers to person.p_id where professor = 1; not faculty member refers to hasPosition = 0; courses refers to taughtBy.course_id
SELECT T2.p_id, T2.course_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 AND T1.hasPosition <> 0
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
computer_student
How many professors are teaching course ID 18?
professors refers to taughtBy.p_id; course ID 18 refers to taughtBy.course_id
SELECT COUNT(DISTINCT p_id) FROM taughtBy WHERE course_id = 18
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
movies_4
How many female characters are there in the movie "Spider-Man 3"?
female characters refer to gender = 'Female'; "Spider-Man 3" refers to title = 'Spider-Man 3'
SELECT COUNT(*) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Spider-Man 3' AND T3.gender = 'Female'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
Which category has the highest number of users?
highest number of users refers to MAX(COUNT(app_id));
SELECT T.category FROM ( SELECT T2.category, COUNT(T1.app_id) AS num FROM app_labels AS T1 INNER JOIN label_categories AS T2 ON T2.label_id = T1.label_id GROUP BY T1.app_id, T2.category ) AS T ORDER BY T.num DESC LIMIT 1
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
computer_student
What are the courses taught by the advisors who gave advice to student with ID 376?
courses refers to course_id; advisors refers to p_id_dummy and taughtBy.p_id; student with ID 376 refers to advisedBy.p_id = 376
SELECT T3.course_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN taughtBy AS T3 ON T2.p_id = T3.p_id WHERE T1.p_id = 141
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
movies_4
Show the total number of keywords of the movie "I Hope They Serve Beer in Hell".
"I Hope They Serve Beer in Hell" refers to title = 'I Hope They Serve Beer in Hell';
SELECT COUNT(T2.keyword_id) FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'I Hope They Serve Beer in Hell'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
What were the locations of the events on 8th May, 2016?
location = longitude, latitude; on 8th May, 2016 refers to `timestamp` LIKE '2016-05-08%';
SELECT longitude, latitude FROM `events` WHERE SUBSTR(`timestamp`, 1, 10) = '2016-05-08'
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
computer_student
How many courses are there for basic or medium undergraduate courses?
basic or medium undergraduate courses refers to courseLevel = 'Level_300'; courses refers to course.course_id
SELECT COUNT(course_id) FROM course WHERE courseLevel = 'Level_300'
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
movies_4
For the movie "Land of the Dead", who is its director?
"Land of the Dead" refers to title = 'Land of the Dead'; director refers to person_name where job = 'Director'
SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Land of the Dead' AND T2.job = 'Director'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
computer_student
Which level of courses is taught by professor ID 297?
professor ID 297 refers to taughtBy.p_id = 297
SELECT T1.courseLevel FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.p_id = 297
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
movies_4
What was David Rubin's job in the movie "Days of Thunder"?
"Days of Thunder" refers to title = 'Days of Thunder'
SELECT T2.job FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'David Rubin' AND T1.title = 'Days of Thunder'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
computer_student
Which professor taught the most courses and what is the position of this person in the university?
professor refers to taughtBy.p_id; most courses refers to max(taughtBy.p_id); position refers to hasPosition
SELECT T1.p_id, T1.hasPosition FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id GROUP BY T1.p_id ORDER BY COUNT(T2.course_id) DESC LIMIT 1
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
computer_student
Provide the ID of professors who are teaching high-level or harder undergraduate course.
ID of professors refers to taughtBy.p_id; high-level or harder undergraduate course refers to courseLevel = 'Level_400'
SELECT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400'
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
talkingdata
What is the ratio of male and female users in 27-28 age group?
ratio = DIVIDE(COUNT(device_id WHERE gender = 'M' AND `group` = 'M27-28'), COUNT(device_id WHERE gender = 'F' AND `group` = 'F27-28')); 27-28 age group refers to `group` = 'F27-28';
SELECT SUM(IIF(gender = 'M' AND `group` = 'M27-28', 1, 0)) / SUM(IIF(gender = 'F' AND `group` = 'F27-28', 1, 0)) AS r FROM gender_age
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
computer_student
List the ID and years in program for students taught by advisor with ID 5.
advisor with ID 5 refers to p_id_dummy = 5
SELECT T1.p_id, T2.yearsInProgram FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T1.p_id_dummy = 5
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
computer_student
Which courses were taught by a professor who is not a faculty member?
courses refers to taughtBy.course_id; professor refers to professor = 1; is not a faculty member refers to hasPosition = 0
SELECT DISTINCT T2.course_id FROM person AS T1 INNER JOIN taughtBy AS T2 ON T1.p_id = T2.p_id WHERE T1.professor = 1 AND T1.hasPosition = 0
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
computer_student
Name the advisors for students in Year 3 of the program.
advisors refers to p_id_dummy; students in Year 3 of the program refers to yearsInProgram = 'Year_3'
SELECT T1.p_id FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_3'
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
movies_4
How many movies were directed by Michael Bay?
directed by refers to job = 'Director'
SELECT COUNT(T2.movie_id) FROM person AS T1 INNER JOIN movie_crew AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Michael Bay' AND T2.job = 'Director'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
Describe the phone brands and models of the users who participated in events on 5th May, 2016 at the coordinates of (112,44).
models refers to device_model; on 5th May, 2016 refers to timestamp LIKE '2016-05-05%'; coordinates of (112,44) refers to longitude = 112 AND latitude = 44;
SELECT DISTINCT T2.phone_brand, T2.device_model FROM events AS T1 INNER JOIN phone_brand_device_model2 AS T2 ON T2.device_id = T1.device_id WHERE T1.timestamp LIKE '2016-05-05%' AND T1.longitude = 112 AND T1.latitude = 44
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
computer_student
Find the ID of advisor of student ID 80 and state the level of courses taught by him/her.
ID of advisor refers to p_id_dummy; student ID 80 refers to advisedBy.p_id = 80; level of courses refers to courseLevel
SELECT T1.p_id_dummy, T2.courseLevel FROM advisedBy AS T1 INNER JOIN course AS T2 ON T1.p_id = T2.course_id INNER JOIN taughtBy AS T3 ON T2.course_id = T3.course_id WHERE T1.p_id = 80
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
talkingdata
How many users used Vivo Xplay3S model?
Vivo Xplay3S model refers to phone_brand = 'vivo' AND device_model = 'Xplay3S';
SELECT COUNT(device_id) FROM phone_brand_device_model2 WHERE device_model = 'Xplay3S' AND phone_brand = 'vivo'
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
computer_student
What level is course 165? List the professors who teach the course.
course 165 refers to course_id = 165; professors refers to taughtBy.p_id
SELECT T1.courseLevel, T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T2.course_id = 165
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
movies_4
Give the name of the movie with a revenue of 559852396.
name of the movie refers to title; revenue of 559852396 refers to revenue = '559852396'
SELECT title FROM movie WHERE revenue = 559852396
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
Describe the device user gender and age of the event ID of 15251.
null
SELECT T1.gender, T1.age FROM gender_age AS T1 INNER JOIN events AS T2 ON T2.device_id = T1.device_id WHERE T2.event_id = 15251
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
computer_student
Who are the professors who gave advice to students in the 12th years of program?
professors refers to p_id_dummy; 12th years of program refers to yearsInProgram = 'Year_12'
SELECT T1.p_id_dummy FROM advisedBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id WHERE T2.yearsInProgram = 'Year_12'
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
movies_4
When was the release date of the latest movie in which Dariusz Wolski worked as a crew member?
release date of the latest movie refers to max(release_date)
SELECT T1.release_date FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' ORDER BY T1.release_date DESC LIMIT 1
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
What are the labels' IDs of online shopping and online malls categories?
null
SELECT label_id FROM label_categories WHERE category IN ('online shopping', 'online malls')
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
talkingdata
Provide the phone brands and models of the users who were at the coordinates of (80,44).
models refers to device_model; coordinates of (80,44) refers to longitude = 80 AND latitude = 44;
SELECT DISTINCT T1.phone_brand, T1.device_model FROM phone_brand_device_model2 AS T1 INNER JOIN events AS T2 ON T2.device_id = T1.device_id WHERE T2.longitude = 80 AND T2.latitude = 44
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
computer_student
State the courses and level of courses by professors who are faculty employees.
professors who are faculty employees refers to professor = 1; faculty employees refers to hasPosition = 'Faculty_eme'
SELECT T3.course_id, T3.courseLevel FROM taughtBy AS T1 INNER JOIN person AS T2 ON T1.p_id = T2.p_id INNER JOIN course AS T3 ON T3.course_id = T1.course_id WHERE T2.hasPosition = 'Faculty_eme'
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
movies_4
Among the movie in which Dariusz Wolski works as the director of photography, what is the percentage of those movie whose vote average is over 5.0?
director of photography refers to job = 'Director of Photography'; vote average is over 8.0 refers to vote_average > 5; percentage = divide(sum(movie_id) when vote_average > 5, count(movie_id)) as percentage
SELECT CAST(COUNT(CASE WHEN T1.vote_average > 5 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.vote_average) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
Provide the app users IDs and time for the event ID of 82.
app user IDs refers to app_id; time refers to timestamp;
SELECT T1.app_id, T2.timestamp FROM app_events AS T1 INNER JOIN events AS T2 ON T2.event_id = T1.event_id WHERE T2.event_id = 82
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
computer_student
Provide the ID of professors who teach in both harder undergraduate course and master/graduate courses.
harder undergraduate course refers to courseLevel = 'Level_400'; master/graduate courses refers to courseLevel = 'Level_500'; ID of professors refers to taughtBy.p_id
SELECT DISTINCT T2.p_id FROM course AS T1 INNER JOIN taughtBy AS T2 ON T1.course_id = T2.course_id WHERE T1.courseLevel = 'Level_400' OR T1.courseLevel = 'Level_500'
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
movies_4
In how many movie does Dariusz Wolski work as the director of photography?
director of photography refers to job = 'Director of Photography'
SELECT COUNT(T2.movie_id) FROM person AS T1 INNER JOIN movie_crew AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography'
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
talkingdata
Describe the ages, genders and numbers of events participated by the users at coordinates of (-102,38).
coordinates of (-102,38) refers to longitude = -102, latitude = 38;
SELECT DISTINCT T1.age, T1.gender, COUNT(T2.event_id) FROM gender_age AS T1 INNER JOIN `events` AS T2 ON T2.device_id = T1.device_id WHERE T2.longitude = -102 AND T2.latitude = 38 GROUP BY T1.age, T1.gender, T2.longitude, T2.latitude
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
List the course's name where students acquired a grade of D.
null
SELECT T1.name FROM course AS T1 INNER JOIN registration AS T2 ON T1.course_id = T2.course_id WHERE T2.grade = 'D'
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );
movies_4
Among the movie in which Dariusz Wolski works as the director of photography, what is the title of the one with the highest average vote?
director of photography refers to job = 'Director of Photography'; highest average vote refers to max(vote_average)
SELECT T1.title FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography' ORDER BY T1.vote_average DESC LIMIT 1
CREATE TABLE language_role ( language_role TEXT default NULL, -- Example Values: `Original`, `Spoken` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 | Column Name Meaning: language role | Column Description: the language role | Value Description: In the context of language roles in a movie or other audio-visual production, "original" and "spoken" refer to the languages in which the movie was originally produced, and the languages spoken by the characters in the movie, respectively. role_id INTEGER not null primary key, ); CREATE TABLE movie_company ( movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 13677 - Distinct count 4452 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) company_id INTEGER default NULL references production_company, -- Example Values: `(14,)`, `(59,)`, `(1,)` | Value Statics: Total count 13677 - Distinct count 5047 - Null count 0 | Column Name Meaning: company id | Column Description: the id of the company that produced the movie Maps to production_company(company_id) | Value Description: If movies with different movie_id have the same company_id, it means these movies were made by the same company. ); CREATE TABLE keyword ( keyword_id INTEGER not null primary key, keyword_name TEXT default NULL, -- Example Values: `('individual',)`, `('holiday',)`, `('germany',)` | Value Statics: Total count 9794 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword name | Column Description: the keyword ); CREATE TABLE movie ( vote_count INTEGER default NULL, -- Example Values: `(530,)`, `(6624,)`, `(6122,)` | Value Statics: Total count 4627 - Distinct count 1595 - Null count 0 | Column Name Meaning: vote count | Column Description: the vote count for the movie | Value Description: If a movie has a higher vote average and vote count, it means that it has been well-received by audiences and critics. A higher vote count means that more people have rated the movie, which can indicate a greater level of interest in the film. tagline TEXT default NULL, -- | Column Description: the tagline of the movie movie_id INTEGER not null primary key, popularity REAL default NULL, -- Example Values: `(22.87623,)`, `(126.393695,)`, `(85.688789,)` | Value Statics: Total count 4627 - Distinct count 4626 - Null count 0 | Column Description: the popularity of the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. runtime INTEGER default NULL, -- Example Values: `(98,)`, `(121,)`, `(100,)` | Value Statics: Total count 4627 - Distinct count 156 - Null count 0 | Column Description: the runtime of the movie budget INTEGER default NULL, -- Example Values: `(4000000,)`, `(11000000,)`, `(94000000,)` | Value Statics: Total count 4627 - Distinct count 427 - Null count 0 | Column Description: the budget for the movie | Value Description: If a movie has higher popularity, it means that it is well-liked by a large number of people. This can be determined by looking at the movie's ratings and reviews, as well as the box office performance and overall buzz surrounding the film. Higher popularity often translates to more success for the movie, both financially and critically. homepage TEXT default NULL, -- Example Values: `('',)`, `('http://www.starwars.com/films/star-wars-episode-iv-a-new-hope',)`, `('http://movies.disney.com/finding-nemo',)` | Value Statics: Total count 4627 - Distinct count 1623 - Null count 0 | Column Description: the homepage of the movie vote_average REAL default NULL, -- Example Values: `(6.5,)`, `(8.1,)`, `(7.6,)` | Value Statics: Total count 4627 - Distinct count 69 - Null count 0 | Column Name Meaning: vote average | Column Description: the average vote for the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. movie_status TEXT default NULL, -- Example Values: `Released`, `Rumored`, `Post Production` | Value Statics: Total count 4627 - Distinct count 3 - Null count 0 | Column Description: the status of the movie The only value of this column is 'Released'. release_date DATE default NULL, -- Example Values: `('1995-12-09',)`, `('1977-05-25',)`, `('2003-05-30',)` | Value Statics: Total count 4627 - Distinct count 3196 - Null count 0 | Column Name Meaning: release date | Column Description: the release date of the movie revenue INTEGER default NULL, -- Example Values: `(4300000,)`, `(775398007,)`, `(940335536,)` | Value Statics: Total count 4627 - Distinct count 3244 - Null count 0 | Column Description: the revenue of the movie | Value Description: A higher vote average indicates that a greater proportion of people who have seen the movie have given it positive ratings. overview TEXT default NULL, -- | Column Description: the overview of the movie title TEXT default NULL, -- Example Values: `('Four Rooms',)`, `('Star Wars',)`, `('Finding Nemo',)` | Value Statics: Total count 4627 - Distinct count 4625 - Null count 0 | Column Description: the title of the movie ); CREATE TABLE movie_keywords ( keyword_id INTEGER default NULL references keyword, -- Example Values: `(612,)`, `(613,)`, `(616,)` | Value Statics: Total count 36162 - Distinct count 9794 - Null count 0 | Column Name Meaning: keyword id | Column Description: the id of the movie keyword Maps to keyword(keyword_id) | Value Description: A movie may have many keywords. Audience could get the genre of the movie according to the movie keywords. movie_id INTEGER default NULL references movie, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 36162 - Distinct count 4391 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) ); CREATE TABLE movie_cast ( foreign key (movie_id) references movie(movie_id), foreign key (gender_id) references gender(gender_id), person_id INTEGER default NULL, -- Example Values: `(85,)`, `(114,)`, `(116,)` | Value Statics: Total count 59083 - Distinct count 32697 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the person Maps to person(person_id) cast_order INTEGER default NULL, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 59083 - Distinct count 213 - Null count 0 | Column Name Meaning: cast order | Column Description: the cast order of the cast | Value Description: The cast order of a movie or television show refers to the sequence in which the actors and actresses are listed in the credits. This order is typically determined by the relative importance of each actor's role in the production, with the main actors and actresses appearing first, followed by the supporting cast and extras. gender_id INTEGER default NULL, -- Example Values: `2`, `1`, `0` | Value Statics: Total count 59083 - Distinct count 3 - Null count 0 | Column Name Meaning: gender id | Column Description: the id of the cast's gender Maps to gender(gender_id) movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 59083 - Distinct count 2443 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (person_id) references person(person_id), character_name TEXT default NULL, -- Example Values: `('Captain Jack Sparrow',)`, `('Will Turner',)`, `('Elizabeth Swann',)` | Value Statics: Total count 59083 - Distinct count 42994 - Null count 0 | Column Name Meaning: character name | Column Description: the character name ); CREATE TABLE genre ( genre_name TEXT default NULL, -- Example Values: `('Adventure',)`, `('Fantasy',)`, `('Animation',)` | Value Statics: Total count 20 - Distinct count 20 - Null count 0 | Column Description: the genre genre_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 | Column Description: the gender | Value Description: female/ male/ unspecified gender_id INTEGER not null primary key, ); CREATE TABLE language ( language_id INTEGER not null primary key, language_code TEXT default NULL, -- Example Values: `('en',)`, `('sv',)`, `('de',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: language code | Column Description: the code of the language | Value Description: Here we use ISO 639 codes to identify the language. language_name TEXT default NULL, -- Example Values: `('English',)`, `('svenska',)`, `('Deutsch',)` | Value Statics: Total count 88 - Distinct count 63 - Null count 0 | Column Name Meaning: language name | Column Description: the language name ); CREATE TABLE production_country ( foreign key (movie_id) references movie(movie_id), foreign key (country_id) references country(country_id), country_id INTEGER default NULL, -- Example Values: `(214,)`, `(131,)`, `(152,)` | Value Statics: Total count 6436 - Distinct count 88 - Null count 0 | Column Name Meaning: country id | Column Description: the id of the country movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 6436 - Distinct count 4629 - Null count 0 | Column Name Meaning: mivie id | Column Description: the unique identifier of the movie ); CREATE TABLE movie_languages ( language_id INTEGER default NULL, -- Example Values: `(24574,)`, `(24575,)`, `(24576,)` | Value Statics: Total count 11740 - Distinct count 88 - Null count 0 | Column Name Meaning: language id | Column Description: the id of the movie language Maps to language(language_id) foreign key (movie_id) references movie(movie_id), language_role_id INTEGER default NULL, -- Example Values: `2`, `1` | Value Statics: Total count 11740 - Distinct count 2 - Null count 0 | Column Name Meaning: language role id | Column Description: the id of the role's language movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 11740 - Distinct count 4803 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) foreign key (language_role_id) references language_role(role_id), foreign key (language_role_id) references language_role(role_id), foreign key (language_id) references language(language_id), ); CREATE TABLE movie_genres ( movie_id INTEGER default NULL, -- Example Values: `(5,)`, `(11,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 4775 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie Maps to movie(movie_id) genre_id INTEGER default NULL, -- Example Values: `(35,)`, `(80,)`, `(12,)` | Value Statics: Total count 12160 - Distinct count 20 - Null count 0 | Column Name Meaning: genre id | Column Description: the id of the movie genre Maps to genre(genre_id) foreign key (movie_id) references movie(movie_id), foreign key (genre_id) references genre(genre_id), ); CREATE TABLE person ( person_name TEXT default NULL, -- Example Values: `('George Lucas',)`, `('Mark Hamill',)`, `('Harrison Ford',)` | Value Statics: Total count 100000 - Distinct count 98472 - Null count 0 | Column Name Meaning: person name | Column Description: the name of the person person_id INTEGER not null primary key, ); CREATE TABLE department ( department_name TEXT default NULL, -- Example Values: `Camera`, `Directing`, `Production`, `Writing`, `Editing` | Value Statics: Total count 12 - Distinct count 12 - Null count 0 | Column Name Meaning: department name | Column Description: the name of the department department_id INTEGER not null primary key, ); CREATE TABLE movie_crew ( job TEXT default NULL, -- Example Values: `('Director of Photography',)`, `('Director',)`, `('Producer',)` | Value Statics: Total count 100000 - Distinct count 415 - Null count 0 | Column Description: the job of the crew | Value Description: A movie may involve several crews with the same job title. foreign key (movie_id) references movie(movie_id), movie_id INTEGER default NULL, -- Example Values: `(285,)`, `(559,)`, `(767,)` | Value Statics: Total count 100000 - Distinct count 3329 - Null count 0 | Column Name Meaning: movie id | Column Description: the id of the movie that the crew worked for Maps to movie(movie_id) person_id INTEGER default NULL, -- Example Values: `(120,)`, `(1704,)`, `(770,)` | Value Statics: Total count 100000 - Distinct count 42294 - Null count 0 | Column Name Meaning: person id | Column Description: the id of the crew Maps to person(person_id) department_id INTEGER default NULL, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 100000 - Distinct count 12 - Null count 0 | Column Name Meaning: department id | Column Description: the id of the crew's department Maps to department(department_id) foreign key (department_id) references department(department_id), foreign key (person_id) references person(person_id), ); CREATE TABLE country ( country_name TEXT default NULL, -- Example Values: `('United Arab Emirates',)`, `('Afghanistan',)`, `('Angola',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country name | Column Description: the name of the country country_id INTEGER not null primary key, country_iso_code TEXT default NULL, -- Example Values: `('AE',)`, `('AF',)`, `('AO',)` | Value Statics: Total count 88 - Distinct count 88 - Null count 0 | Column Name Meaning: country iso code | Column Description: the ISO code | Value Description: ISO codes are typically used to identify countries and their subdivisions, and there are different types of ISO codes depending on the specific application. Here we use ISO 3166 code to identify countries. ); CREATE TABLE production_company ( company_id INTEGER not null primary key, company_name TEXT default NULL, -- Example Values: `('Lucasfilm',)`, `('Walt Disney Pictures',)`, `('Pixar Animation Studios',)` | Value Statics: Total count 5047 - Distinct count 5017 - Null count 0 | Column Name Meaning: company name | Column Description: the name of the company );
computer_student
How many courses were taught by more than 4 people?
courses refers to taughtBy.course_id; more than 4 people refers to count(taughtBy.p_id) > 4
SELECT COUNT(*) FROM ( SELECT COUNT(course_id) FROM taughtBy GROUP BY course_id HAVING COUNT(course_id) > 4 )
CREATE TABLE advisedBy ( constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_person_p_id_p_id_fk foreign key (p_id, p_id_dummy) references person (p_id, p_id), constraint advisedBy_pk primary key (p_id, p_id_dummy), p_id INTEGER, -- Example Values: `(6,)`, `(9,)`, `(13,)` | Value Statics: Total count 113 - Distinct count 91 - Null count 0 | Column Name Meaning: person id | Column Description: id number identifying each person p_id_dummy INTEGER, -- Example Values: `(5,)`, `(7,)`, `(29,)` | Value Statics: Total count 113 - Distinct count 39 - Null count 0 | Column Name Meaning: person id dummy | Column Description: the id number identifying the advisor ); CREATE TABLE person ( professor INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a professor | Value Description: 0: professor 1: student hasPosition TEXT, -- Example Values: `0`, `Faculty`, `Faculty_adj`, `Faculty_eme`, `Faculty_aff` | Value Statics: Total count 278 - Distinct count 5 - Null count 0 | Column Name Meaning: has position | Column Description: whether the person has a position in the faculty | Value Description: 0: the person is not a faculty member Common Sense evidence: faculty_aff: affiliated faculty faculty_eme: faculty employee yearsInProgram TEXT, -- Example Values: `0`, `Year_2`, `Year_5`, `Year_7`, `Year_10` | Value Statics: Total count 278 - Distinct count 12 - Null count 0 | Column Name Meaning: years in program | Column Description: the year of the program the person is at | Value Description: 0: the person is not in any programs Common Sense evidence: yearX means the person is on the Xth year of the program student INTEGER, -- Example Values: `1`, `0` | Value Statics: Total count 278 - Distinct count 2 - Null count 0 | Column Description: whether the person is a student | Value Description: 0: professor 1: student inPhase TEXT, -- Example Values: `0`, `Post_Quals`, `Post_Generals`, `Pre_Quals` | Value Statics: Total count 278 - Distinct count 4 - Null count 0 | Column Name Meaning: in phase | Column Description: the phase of qualification the person is undergoing | Value Description: 0: the person is not undergoing the phase of qualification p_id INTEGER constraint person_pk primary key, ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, courseLevel TEXT, -- Example Values: `Level_500`, `Level_300`, `Level_400` | Value Statics: Total count 132 - Distinct count 3 - Null count 0 | Column Name Meaning: course level | Column Description: course level | Value Description: • Level_300: basic or medium undergraduate courses. • Level_400: high-level or harder undergraduate course. • Level_500: professional or master/graduate courses ); CREATE TABLE taughtBy ( course_id INTEGER, -- Example Values: `(0,)`, `(1,)`, `(2,)` | Value Statics: Total count 189 - Distinct count 113 - Null count 0 | Column Name Meaning: course ID | Column Description: the identification number identifying each course primary key (course_id, p_id), foreign key (course_id) references course(course_id), p_id INTEGER, -- Example Values: `(40,)`, `(180,)`, `(279,)` | Value Statics: Total count 189 - Distinct count 64 - Null count 0 | Column Name Meaning: person ID | Column Description: the identification number identifying each person foreign key (p_id) references person(p_id), );
talkingdata
Among HTC Butterfly phone users, list any five devices' IDs used by females.
HTC Butterfly refers to phone_brand = 'HTC' AND device_model = 'Butterfly'; females refers to gender = 'F';
SELECT T2.device_id FROM phone_brand_device_model2 AS T1 INNER JOIN gender_age AS T2 ON T2.device_id = T1.device_id WHERE T1.device_model = 'Butterfly' AND T2.gender = 'F' AND T1.phone_brand = 'HTC' LIMIT 5
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
talkingdata
How many events did the 88-years-old male users participate on 4th May,2016?
88-years-old refers to age = 88; male refers to gender = 'M'; on 4th May, 2016 refers to timestamp LIKE '2016-05-04%';
SELECT COUNT(T2.event_id) FROM gender_age AS T1 INNER JOIN events AS T2 ON T2.device_id = T1.device_id WHERE T1.gender = 'M' AND SUBSTR(`timestamp`, 1, 10) = '2016-05-04' AND T1.age = 88
CREATE TABLE app_labels ( `label_id` INTEGER NOT NULL, -- Example Values: `(251,)`, `(406,)`, `(407,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Name Meaning: label id | Column Description: id of labels represents which behavior category that each user belongs to FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`label_id`) REFERENCES `label_categories` (`label_id`) ON DELETE CASCADE ON UPDATE CASCADE, `app_id` INTEGER NOT NULL, -- Example Values: `(7324884708820027918,)`, `(-4494216993218550286,)`, `(6058196446775239644,)` | Value Statics: Total count 100000 - Distinct count 49118 - Null count 0 | Column Name Meaning: app id | Column Description: id of the app user ); CREATE TABLE events_relevant ( FOREIGN KEY (`device_id`) REFERENCES `gender_age` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, `device_id` INTEGER DEFAULT NULL, -- `timestamp` DATETIME NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8764672938472212518,)`, `(-9050100410106163077,)` | Value Statics: Total count 100000 - Distinct count 2195 - Null count 0 `longitude` REAL NOT NULL, -- Example Values: `1.0` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`event_id`), `latitude` REAL NOT NULL, -- Example Values: `0.0`, `1.0` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 ); CREATE TABLE gender_age ( `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 39923 - Distinct count 2 - Null count 60077 | Column Description: gender of the user who uses this device `group` TEXT DEFAULT NULL, -- Example Values: `M29-31`, `M32-38`, `F29-32`, `M22-`, `M39+` | Value Statics: Total count 39923 - Distinct count 12 - Null count 60077 | Column Description: group of the ages `age` INTEGER DEFAULT NULL, -- Example Values: `(29,)`, `(31,)`, `(38,)` | Value Statics: Total count 39923 - Distinct count 81 - Null count 60077 | Column Description: age of the user who uses this device | Value Description: • M: male; • F: female PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9221086586254644858,)`, `(-9221079146476055829,)`, `(-9221066489596332354,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: device id | Column Description: unique number of devices FOREIGN KEY (`device_id`) REFERENCES `phone_brand_device_model2` (`device_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE events ( `longitude` REAL DEFAULT NULL, -- Example Values: `(121.0,)`, `(104.0,)`, `(107.0,)` | Value Statics: Total count 100000 - Distinct count 75 - Null count 0 | Column Description: longitude | Value Description: the location / coordinate = (longitude, latitude) `device_id` INTEGER DEFAULT NULL, -- Example Values: `(29182687948017175,)`, `(-6401643145415154744,)`, `(-4833982096941402721,)` | Value Statics: Total count 100000 - Distinct count 27310 - Null count 0 | Column Name Meaning: device id | Column Description: id number referring the device `timestamp` DATETIME DEFAULT NULL, -- Example Values: `('2016-05-01 00:55:25.0',)`, `('2016-05-01 00:54:12.0',)`, `('2016-05-01 00:08:05.0',)` | Value Statics: Total count 100000 - Distinct count 91246 - Null count 0 | Column Description: the time of the event `latitude` REAL DEFAULT NULL, -- Example Values: `(31.0,)`, `(30.0,)`, `(23.0,)` | Value Statics: Total count 100000 - Distinct count 53 - Null count 0 | Column Description: latitude `event_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 | Column Name Meaning: event id | Column Description: unique id number referring to the event PRIMARY KEY (`event_id`), ); CREATE TABLE phone_brand_device_model2 ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223067244542181226,)`, `(-9223042152723782980,)` | Value Statics: Total count 89200 - Distinct count 89195 - Null count 0 | Column Name Meaning: device id | Column Description: the id number of the device PRIMARY KEY (`device_id`,`phone_brand`,`device_model`), `phone_brand` TEXT NOT NULL, -- Example Values: `('小米',)`, `('vivo',)`, `('三星',)` | Value Statics: Total count 89200 - Distinct count 122 - Null count 0 | Column Name Meaning: phone brand | Column Description: phone brand | Value Description: phone_brand has duplicated values since some device models belong to the same brand `device_model` TEXT NOT NULL, -- Example Values: `('红米note',)`, `('Y19T',)`, `('MI 3',)` | Value Statics: Total count 89200 - Distinct count 1490 - Null count 0 | Column Name Meaning: device model | Column Description: device model | Value Description: phone_brand has duplicated values since some device models belong to the same brand ); CREATE TABLE sample_submission ( `F29-32` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M39+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M32-38` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 13700 - Distinct count 13700 - Null count 0 `M27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M29-31` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F23-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 PRIMARY KEY (`device_id`), `M23-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `M22-` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F24-26` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F33-42` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F27-28` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 `F43+` REAL DEFAULT NULL, -- Example Values: `0.0833` | Value Statics: Total count 13700 - Distinct count 1 - Null count 0 ); CREATE TABLE app_events ( `is_active` INTEGER NOT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 | Column Name Meaning: is active | Column Description: whether this user is active or not PRIMARY KEY (`event_id`,`app_id`), `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3553 - Null count 0 | Column Name Meaning: event id | Column Description: the id of events `is_installed` INTEGER NOT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 | Column Name Meaning: is installed | Column Description: whether this app is installed or not | Value Description: • 0: no • 1: yes: installed `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5504 - Null count 0 | Column Name Meaning: app id | Column Description: the id of app users | Value Description: each app_id represents for an user FOREIGN KEY (`event_id`) REFERENCES `events` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, ); CREATE TABLE gender_age_train ( `group` TEXT DEFAULT NULL, -- Example Values: `M23-26`, `M32-38`, `M29-31`, `F43+`, `F27-28` | Value Statics: Total count 74645 - Distinct count 12 - Null count 0 `gender` TEXT DEFAULT NULL, -- Example Values: `M`, `F` | Value Statics: Total count 74645 - Distinct count 2 - Null count 0 `age` INTEGER DEFAULT NULL, -- Example Values: `(24,)`, `(36,)`, `(29,)` | Value Statics: Total count 74645 - Distinct count 85 - Null count 0 PRIMARY KEY (`device_id`), `device_id` INTEGER NOT NULL, -- Example Values: `(-9223067244542181226,)`, `(-9222956879900151005,)`, `(-9222754701995937853,)` | Value Statics: Total count 74645 - Distinct count 74645 - Null count 0 ); CREATE TABLE label_categories ( `label_id` INTEGER NOT NULL, -- Example Values: `(1,)`, `(2,)`, `(3,)` | Value Statics: Total count 930 - Distinct count 930 - Null count 0 | Column Name Meaning: label id | Column Description: unique id of label `category` TEXT DEFAULT NULL, -- Example Values: `('game-game type',)`, `('game-Game themes',)`, `('game-Art Style',)` | Value Statics: Total count 927 - Distinct count 833 - Null count 3 | Column Description: category of the label PRIMARY KEY (`label_id`), ); CREATE TABLE gender_age_test ( `device_id` INTEGER NOT NULL, -- Example Values: `(-9223321966609553846,)`, `(-9223042152723782980,)`, `(-9222896629442493034,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 PRIMARY KEY (`device_id`), ); CREATE TABLE app_events_relevant ( `app_id` INTEGER NOT NULL, -- Example Values: `(-8942695423876075857,)`, `(-8022267440849930066,)`, `(-5720078949152207372,)` | Value Statics: Total count 100000 - Distinct count 5483 - Null count 0 FOREIGN KEY (`app_id`) REFERENCES `app_all` (`app_id`) ON DELETE CASCADE ON UPDATE CASCADE, `event_id` INTEGER NOT NULL, -- Example Values: `(2,)`, `(6,)`, `(7,)` | Value Statics: Total count 100000 - Distinct count 3518 - Null count 0 FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, FOREIGN KEY (`event_id`) REFERENCES `events_relevant` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`event_id`,`app_id`), `is_active` INTEGER DEFAULT NULL, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 `is_installed` INTEGER DEFAULT NULL, -- Example Values: `1` | Value Statics: Total count 100000 - Distinct count 1 - Null count 0 ); CREATE TABLE app_all ( PRIMARY KEY (`app_id`), `app_id` INTEGER NOT NULL, -- Example Values: `(-9223281467940916832,)`, `(-9222877069545393219,)`, `(-9222785464897897681,)` | Value Statics: Total count 100000 - Distinct count 100000 - Null count 0 );
cs_semester
Of courses with 3 credit, how many students have GPA of 3.2?
null
SELECT COUNT(T1.student_id) FROM student AS T1 INNER JOIN registration AS T2 ON T1.student_id = T2.student_id INNER JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.credit = 3 AND T1.gpa = 3.2
CREATE TABLE student ( phone_number TEXT, -- Example Values: `('(243) 6836472',)`, `('(672) 9245255',)`, `('(521) 7680522',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: phone number | Column Description: phone number type TEXT, -- Example Values: `RPG`, `TPG`, `UG` | Value Statics: Total count 38 - Distinct count 3 - Null count 0 | Column Description: type of the student | Value Description: • TPG: taught postgraduate student(master) • RPG: research postgraduate student (master) • UG: undergraduate student(bachelor) both TPG and RPG are students pursuing a master’s degree; UG are students pursuing the bachelor degree intelligence INTEGER, -- Example Values: `5`, `2`, `1`, `3`, `4` | Value Statics: Total count 38 - Distinct count 5 - Null count 0 | Column Description: intelligence of the student | Value Description: higher --> more intelligent student_id INTEGER primary key, l_name TEXT, -- Example Values: `('Pryor',)`, `('Dine-Hart',)`, `('Shiril',)` | Value Statics: Total count 38 - Distinct count 37 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the student | Value Description: full name: f_name, l_name f_name TEXT, -- Example Values: `('Kerry',)`, `('Chrysa',)`, `('Elsy',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the student email TEXT, -- Example Values: `('[email protected]',)`, `('[email protected]',)`, `('[email protected]',)` | Value Statics: Total count 38 - Distinct count 38 - Null count 0 | Column Description: email gpa REAL, -- Example Values: `2.4`, `2.7`, `3.5`, `2.8`, `3.9` | Value Statics: Total count 38 - Distinct count 16 - Null count 0 | Column Name Meaning: graduate point average | Column Description: gpa ); CREATE TABLE prof ( teachingability INTEGER, -- Example Values: `5`, `1`, `2`, `3`, `4` | Value Statics: Total count 10 - Distinct count 5 - Null count 0 | Column Name Meaning: teaching ability | Column Description: the teaching ability of the professor | Value Description: higher --> more teaching ability, his / her lectures may have better quality graduate_from TEXT, -- Example Values: `University of Washington`, `Beijing Polytechnic University`, `University of Boston`, `Carnegie Mellon University`, `Princeton University` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: graduate from | Column Description: the school where the professor graduated from popularity INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: popularity of the professor | Value Description: higher --> more popular first_name TEXT, -- Example Values: `Nathaniel`, `Zhihua`, `Ogdon`, `Merwyn`, `Bernhard` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: first name | Column Description: the first name of the professor email TEXT, -- Example Values: `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Description: email of the professor gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 10 - Distinct count 2 - Null count 0 | Column Description: gender of the professor last_name TEXT, -- Example Values: `Pigford`, `Zhou`, `Zywicki`, `Conkay`, `Molen` | Value Statics: Total count 10 - Distinct count 10 - Null count 0 | Column Name Meaning: last name | Column Description: the last name of the professor | Value Description: full name: first name, last name prof_id INTEGER constraint prof_pk primary key, ); CREATE TABLE RA ( salary TEXT, -- Example Values: `med`, `high`, `low`, `free` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the salary of this student. | Value Description: med: average salary high: higher salary than others low: lower salary free: unpaid RA foreign key (student_id) references student(student_id), prof_id INTEGER, -- Example Values: `7`, `10`, `13`, `9`, `2` | Value Statics: Total count 35 - Distinct count 13 - Null count 0 | Column Name Meaning: professor id | Column Description: professor who advises this student | Value Description: this value may be repetitive since one professor may advise many students in this semester if a professor advise > 2 students in this semester, it means this professor's research work is heavy or: this professor's popularity on research is higher primary key (student_id, prof_id), foreign key (prof_id) references prof(prof_id), capability INTEGER, -- Example Values: `2`, `5`, `4`, `3` | Value Statics: Total count 35 - Distinct count 4 - Null count 0 | Column Description: the capability of student on research (Evaluated by the professor) | Value Description: higher --> higher research ability / capability student_id INTEGER, -- Example Values: `(2,)`, `(5,)`, `(6,)` | Value Statics: Total count 35 - Distinct count 21 - Null count 0 | Column Name Meaning: student id | Column Description: the id numbe representing each student ); CREATE TABLE registration ( primary key (course_id, student_id), sat INTEGER, -- Example Values: `5`, `4`, `3`, `2`, `1` | Value Statics: Total count 101 - Distinct count 5 - Null count 0 | Column Name Meaning: satisfying degree | Column Description: student satisfaction with the course student_id INTEGER, -- Example Values: `(2,)`, `(3,)`, `(4,)` | Value Statics: Total count 101 - Distinct count 36 - Null count 0 | Column Name Meaning: student id | Column Description: the id of students foreign key (course_id) references course(course_id), grade TEXT, -- Example Values: `A`, `B`, `C`, `D` | Value Statics: Total count 96 - Distinct count 4 - Null count 5 | Column Description: the grades that the students acquire in this course | Value Description: • A: excellent -- 4 • B: good -- 3 • C: fair -- 2 • D: poorly pass -- 1 • null or empty: this student fails to pass this course • gpa of students for this semester = sum (credits x grade) / sum (credits) course_id INTEGER, -- Example Values: `1`, `2`, `3`, `4`, `5` | Value Statics: Total count 101 - Distinct count 13 - Null count 0 | Column Name Meaning: course id | Column Description: the id of courses foreign key (student_id) references student(student_id), ); CREATE TABLE course ( course_id INTEGER constraint course_pk primary key, diff INTEGER, -- Example Values: `3`, `4`, `1`, `5`, `2` | Value Statics: Total count 13 - Distinct count 5 - Null count 0 | Column Name Meaning: difficulty | Column Description: difficulty of the course | Value Description: higher --> more difficult smaller --> less difficult credit INTEGER, -- Example Values: `3`, `2` | Value Statics: Total count 13 - Distinct count 2 - Null count 0 | Column Description: credit of the course | Value Description: higher means more important name TEXT, -- Example Values: `Machine Learning Theory`, `Intro to Database 1`, `Intro to Database 2`, `Natural Language Processing`, `Intro to BlockChain` | Value Statics: Total count 13 - Distinct count 13 - Null count 0 | Column Description: name of the course );