Find Top Scoring Students II
[]
['CREATE TABLE if not exists students (\n    student_id INT ,\n    name VARCHAR(255),\n    major VARCHAR(255)\n)', "CREATE TABLE if not exists courses (\n    course_id INT ,\n    name VARCHAR(255),\n    credits INT,\n    major VARCHAR(255),\n    mandatory ENUM('yes', 'no') DEFAULT 'no'\n)", 'CREATE TABLE  if not exists enrollments (\n    student_id INT,\n    course_id INT,\n    semester VARCHAR(255),\n    grade VARCHAR(10),\nGPA decimal(3,2)\n\n);', 'Truncate table students', "insert into students (student_id, name, major) values ('1', 'Alice', 'Computer Science')", "insert into students (student_id, name, major) values ('2', 'Bob', 'Computer Science')", "insert into students (student_id, name, major) values ('3', 'Charlie', 'Mathematics')", "insert into students (student_id, name, major) values ('4', 'David', 'Mathematics')", 'Truncate table courses', "insert into courses (course_id, name, credits, major, mandatory) values ('101', 'Algorithms', '3', 'Computer Science', 'Yes')", "insert into courses (course_id, name, credits, major, mandatory) values ('102', 'Data Structures', '3', 'Computer Science', 'Yes')", "insert into courses (course_id, name, credits, major, mandatory) values ('103', 'Calculus', '4', 'Mathematics', 'Yes')", "insert into courses (course_id, name, credits, major, mandatory) values ('104', 'Linear Algebra', '4', 'Mathematics', 'Yes')", "insert into courses (course_id, name, credits, major, mandatory) values ('105', 'Machine Learning', '3', 'Computer Science', 'No')", "insert into courses (course_id, name, credits, major, mandatory) values ('106', 'Probability', '3', 'Mathematics', 'No')", "insert into courses (course_id, name, credits, major, mandatory) values ('107', 'Operating Systems', '3', 'Computer Science', 'No')", "insert into courses (course_id, name, credits, major, mandatory) values ('108', 'Statistics', '3', 'Mathematics', 'No')", 'Truncate table enrollments', "insert into enrollments (student_id, course_id, semester, grade, GPA) values ('1', '101', 'Fall 2023', 'A', '4.0')", "insert into enrollments (student_id, course_id, semester, grade, GPA) values ('1', '102', 'Spring 2023', 'A', '4.0')", "insert into enrollments (student_id, course_id, semester, grade, GPA) values ('1', '105', 'Spring 2023', 'A', '4.0')", "insert into enrollments (student_id, course_id, semester, grade, GPA) values ('1', '107', 'Fall 2023', 'B', '3.5')", "insert into enrollments (student_id, course_id, semester, grade, GPA) values ('2', '101', 'Fall 2023', 'A', '4.0')", "insert into enrollments (student_id, course_id, semester, grade, GPA) values ('2', '102', 'Spring 2023', 'B', '3.0')", "insert into enrollments (student_id, course_id, semester, grade, GPA) values ('3', '103', 'Fall 2023', 'A', '4.0')", "insert into enrollments (student_id, course_id, semester, grade, GPA) values ('3', '104', 'Spring 2023', 'A', '4.0')", "insert into enrollments (student_id, course_id, semester, grade, GPA) values ('3', '106', 'Spring 2023', 'A', '4.0')", "insert into enrollments (student_id, course_id, semester, grade, GPA) values ('3', '108', 'Fall 2023', 'B', '3.5')", "insert into enrollments (student_id, course_id, semester, grade, GPA) values ('4', '103', 'Fall 2023', 'B', '3.0')", "insert into enrollments (student_id, course_id, semester, grade, GPA) values ('4', '104', 'Spring 2023', 'B', '3.0')"]
{"mysql": ["CREATE TABLE if not exists students (\n    student_id INT ,\n    name VARCHAR(255),\n    major VARCHAR(255)\n)", "CREATE TABLE if not exists courses (\n    course_id INT ,\n    name VARCHAR(255),\n    credits INT,\n    major VARCHAR(255),\n    mandatory ENUM('yes', 'no') DEFAULT 'no'\n)", "CREATE TABLE  if not exists enrollments (\n    student_id INT,\n    course_id INT,\n    semester VARCHAR(255),\n    grade VARCHAR(10),\nGPA decimal(3,2)\n\n);"], "mssql": ["CREATE TABLE students (\n    student_id INT ,\n    name VARCHAR(255),\n    major VARCHAR(255)\n)", "CREATE TABLE courses (\n    course_id INT PRIMARY KEY,\n    name VARCHAR(255),\n    credits INT,\n    major VARCHAR(255),\n    mandatory VARCHAR(3) CHECK (mandatory IN ('yes', 'no')) DEFAULT 'no'\n)", "CREATE TABLE enrollments (\n    student_id INT,\n    course_id INT,\n    semester VARCHAR(255),\n    grade VARCHAR(1),\n    GPA DECIMAL(3,2)\n)"], "oraclesql": ["CREATE TABLE students (\n    student_id NUMBER ,\n    name VARCHAR2(255),\n    major VARCHAR2(255)\n)", "CREATE TABLE courses (\n    course_id NUMBER ,\n    name VARCHAR2(255),\n    credits NUMBER,\n    major VARCHAR2(255),\n    mandatory VARCHAR2(3) CHECK (mandatory IN ('Yes', 'No')) \n)", "CREATE TABLE enrollments (\n    student_id NUMBER,\n    course_id NUMBER,\n    semester VARCHAR2(255),\n    grade VARCHAR2(1),\n    GPA Number (3,2)\n)"], "database": true, "name": "find_top_scoring_students", "pythondata": ["students = pd.DataFrame([], columns=['student_id', 'name', 'major']).astype({\n    'student_id': 'Int64',  # Nullable integer type for student_id\n    'name': 'string',       # String type for names\n    'major': 'string'       # String type for majors\n})", "courses = pd.DataFrame([], columns=['course_id', 'name', 'credits', 'major', 'mandatory']).astype({'course_id': 'Int64', 'name': 'string', 'credits': 'Int64', 'major': 'string', 'mandatory': 'string'})\n\n # pd.CategoricalDtype(categories=['yes', 'no'])\n", "enrollments = pd.DataFrame([], columns=['student_id', 'course_id', 'semester', 'grade', 'GPA']).astype({'student_id': 'Int64', 'course_id': 'Int64', 'semester': 'string', 'grade': 'string', 'GPA': 'float'})\n"], "postgresql": ["CREATE TABLE IF NOT EXISTS students (\n    student_id SERIAL,\n    name VARCHAR(255),\n    major VARCHAR(255)\n);", "CREATE TABLE courses (\n    course_id INTEGER,  -- or SERIAL if you want auto-increment\n    name VARCHAR(255),\n    credits INTEGER,    -- or NUMERIC if you need decimal places\n    major VARCHAR(255),\n    mandatory VARCHAR(3) CHECK (mandatory IN ('Yes', 'No'))\n);\n", "CREATE TABLE IF NOT EXISTS enrollments (\n    student_id INT,\n    course_id INT,\n    semester VARCHAR(255),\n    grade VARCHAR(10),\n    GPA NUMERIC(3,2)\n);\n"], "database_schema": {"students": {"student_id": "INT", "name": "VARCHAR(255)", "major": "VARCHAR(255)"}, "courses": {"course_id": "INT", "name": "VARCHAR(255)", "credits": "INT", "major": "VARCHAR(255)", "mandatory": "ENUM('yes', 'no')"}, "enrollments": {"student_id": "INT", "course_id": "INT", "semester": "VARCHAR(255)", "grade": "VARCHAR(10)", "GPA": "DECIMAL(3, 2)"}}}
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16</p>"]}
['Database']