Authorized Domain Required

This compiler only runs on cbsepython.in (and its official subdomains). Copying or running this page on unauthorized domains is restricted.

πŸ“Š Active Database: | Tables: students, courses | Rows: 13
πŸ“ SQL Query Editor MySQL 8.0
πŸ–₯️ Output
βœ“ CBSEPython.in - Online MySQL & Python Compiler Ready! Free Browser Lab for CBSE Class 11 & 12 Computer Science ───────────────────────────────────────── Click 'Examples' to load Class 12 SQL & Python mysql.connector programs. Both SQL Editor and Python MySQL share the same browser-persisted database! Keyboard Shortcut: Ctrl/Cmd + Enter to execute | Ctrl/Cmd + S to save Visit: www.cbsepython.in for more tutorials
CBSEPython.in - Browser Simulator Ready
πŸŽ“ Built for CBSE Class 11 & 12 Students | www.cbsepython.in

Online MySQL Compiler & Online Python Compiler for CBSE Class 12 Students

Preparing for CBSE Class 11 and Class 12 Computer Science practicals or board exams often requires testing SQL queries and Python database connectivity right away. With this online MySQL compiler and online Python compiler on CBSEPython.in, students can write SQL statements, create databases and tables, and run mysql.connector scripts directly in the browser without installing heavy software on every device.

Simulator note: This tool runs locally in your browser using SQLite WASM (sql.js) and Pyodide as a learning simulator rather than a live MySQL server, so certain MySQL-specific syntax and data types behave according to SQLite rules.

Why Use an Online MySQL Compiler & Online Python Compiler Together?

In CBSE Class 12 Computer Science, database questions do not stop at standalone SQL commandsβ€”students must also connect Python programs to relational tables using mysql.connector. Having both an online SQL editor and an online Python compiler connected to the same browser database lets you:

Core CBSE Class 12 SQL & Python Connectivity Cheatsheet

1. Database & Table DDL

CREATE DATABASE IF NOT EXISTS school_db;
USE school_db;
SHOW DATABASES;
SHOW TABLES;
DESCRIBE students;
ALTER TABLE students ADD COLUMN grade TEXT;

2. Filtering, Sorting & Aggregates

SELECT DISTINCT city FROM students;
SELECT name, marks FROM students
WHERE marks BETWEEN 80 AND 95
  AND city IN ('Delhi', 'Mumbai')
ORDER BY marks DESC LIMIT 5;
SELECT class, COUNT(*), AVG(marks)
FROM students GROUP BY class HAVING COUNT(*) >= 2;

3. Joins & DML

SELECT s.name, c.course_name
FROM students s
INNER JOIN courses c ON s.id = c.student_id;

UPDATE students SET marks = marks + 2 WHERE class = 12;
DELETE FROM students WHERE marks < 50;

4. Python mysql.connector

import mysql.connector
con = mysql.connector.connect(
    host="localhost", user="root",
    password="", database="students_db"
)
cur = con.cursor()
cur.execute("SELECT * FROM students WHERE marks > %s", (85,))
print(cur.fetchall())
con.close()

How to Get the Most Out of This Practice Lab

  1. Start with the sample data: Inspect students and courses using the table chips above or load any preset from the Examples drawer.
  2. Practice one concept at a time: Run WHERE, LIKE, GROUP BY, and JOIN examples, then check how each clause changes the output rows.
  3. Switch to Python MySQL mode: Test fetchall(), fetchone(), parameterized INSERT/UPDATE/DELETE, and error handling with try...except.
  4. Reset when needed: Use Reset Databases whenever you want a clean copy of the sample records.

Frequently Asked Questions (CBSE Students)

Q1. Is this a real MySQL server or a browser simulator?
It is a browser-based learning simulator powered by SQLite WASM and Pyodide. Basic SQL commands and CBSE mysql.connector patterns work interactively in the browser, while some server-specific MySQL features may differ.

Q2. Do SQL queries and Python code share the same database?
Yes. Changes made in SQL Editor or Python MySQL mode update the shared browser database state and persist in localStorage until reset or cleared.

Q3. What keyboard shortcuts are supported?
Press Ctrl + Enter (or Cmd + Enter on Mac) to execute code, and Ctrl + S (or Cmd + S) to save your current code.

πŸ“š CBSEPython.in Examples