On this page
If your CBSE Class 12 computer science project stores data in MySQL, an AI chatbot can write your queries in seconds. The catch is that a wrong query rarely crashes. It returns a neat table of believable numbers.
The CBSE Class 12 Computer Science curriculum for 2026-27 gives the project 8 of the 30 practical marks, the SQL lab test 4 marks and the viva 3 marks. The same document says projects should be done in groups of two to three and that students should be made aware of the need to avoid plagiarism.
Why does AI-written SQL go wrong?
A team led by Jinyang Li built BIRD, a test of whether language models can turn questions into SQL for large, real databases, and presented it at NeurIPS 2023. In their paper, ChatGPT's queries achieved 40.08% execution accuracy, while people reached 92.96%. Execution accuracy asks one thing: did the query return the right result?
Your project tables are far simpler than BIRD's, and models have changed since 2023, so do not read that number as today's error rate. The lesson that holds is this: a query that runs is not the same as a query that is right.
How do you check SQL queries written by AI?
Use a sample so small that you can work out the answer on paper before the computer does.
Make two tiny tables. STUDENTS has four rows: roll 1 Aarav (Red house), roll 2 Diya (Blue), roll 3 Aarav (Blue), roll 4 Meera (Red). MARKS has six rows: roll 1 Maths 80 and Physics 70, roll 2 Maths 90 and Physics 85, roll 3 Maths 60, roll 4 Maths 75.
Put a trap in on purpose. The two Aaravs test grouping.
Write the expected answers by hand. Joining the tables should give 6 rows. Red house averages 75 and Blue house averages 78.33. Roll 1 Aarav totals 150.
Paste the AI's query, run it, and compare. If they differ, suspect the query before your arithmetic.
For a refresher, our guide to SELECT, WHERE, GROUP BY and joins for CBSE covers them with examples.
What do wrong joins, missing WHERE clauses and GROUP BY slips look like?
The 2026-27 syllabus lists Cartesian product, equi-join, GROUP BY, HAVING, UPDATE and DELETE, so all three slips below are examinable.
A wrong join gives 24 rows instead of 6. If the AI writes FROM students, marks with no condition linking the roll numbers, you get a Cartesian product: every student paired with every mark, 4 times 6 equals 24 rows. Average by house and both houses show 76.67, because each house now sees all six marks. Two different groups with identical averages is a classic warning sign. The fix is WHERE students.roll = marks.roll, or JOIN ... ON with the same condition.
A missing WHERE changes 6 rows instead of 1. Ask for 5 grace marks on roll 3's Maths score. If the reply is UPDATE marks SET score = score + 5 with no WHERE clause, all six rows change. In Python, cursor.rowcount should report 1. While testing, run SET sql_safe_updates = 1 first: the MySQL manual says this makes UPDATE and DELETE fail unless the WHERE clause uses a key or the statement has a LIMIT. Give MARKS a primary key on roll and subject so the correct query still runs.
A GROUP BY slip turns two Aaravs into one. If the AI groups totals by name, the two Aaravs merge into one row of 210 marks (150 plus 60). Group by roll, the primary key, and show the name alongside. A related trap is selecting a column that is neither grouped nor aggregated. The MySQL manual on GROUP BY says ONLY_FULL_GROUP_BY is on by default and rejects such queries; if it is switched off, the server is free to choose any value from each group. When that error appears, fix the query instead of turning the setting off.
What should you check before you submit?
The row count matches your hand count.
Every query on two tables has a condition linking their keys.
Every UPDATE and DELETE has a WHERE clause, and rowcount matches what you meant to change.
Every column in SELECT is either in GROUP BY or inside MAX, MIN, AVG, SUM or COUNT.
You can explain each line aloud, because the examiner may ask in the viva.
A useful prompt for the chatbot: "Explain this query line by line and tell me how many rows it returns on my sample data." Then check its claim against your paper answer. The sample tables also belong in your report file; our guide to the CBSE computer science practical file and viva shows how to lay it out, and the walkthrough on connecting Python to MySQL covers rowcount and commit().
If joins or grouping still feel shaky, Fermi's AI tutor teaches rather than just answering: it notices where you are stuck and decides whether to explain, ask or show. The Fermi Concept Library has a lesson for each concept in computing.



