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 masters 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 masters 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 masters 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 masters 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 masters 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
);
|
End of preview. Expand
in Data Studio
No dataset card yet
- Downloads last month
- 13