MySQL interview questions test your knowledge of SQL joins, normalisation, indexing, ACID transactions and stored procedures. Freshers at Indian IT companies like Infosys, TCS and Wipro typically face 8 to 12 SQL questions per round. This guide covers every major topic with viva-ready answers and whiteboard queries you can practise today.
- Key Takeaway 1: SQL joins, especially INNER JOIN vs LEFT JOIN, appear in nearly every fresher and experienced interview round.
- Key Takeaway 2: Normalisation up to 3NF is the most-tested DBMS viva topic in Indian engineering colleges and campus placements.
- Key Takeaway 3: Indexing and ACID properties are the two concepts that separate average candidates from shortlisted ones.
- Key Takeaway 4: Oracle and MySQL syntax differ in small but interview-critical ways, so know both if you are targeting product companies.
- Key Takeaway 5: Writing a clean query on a whiteboard, without IDE help, is a skill most candidates underestimate until it costs them the offer.
SQL and MySQL Interview Questions Freshers Actually Get Asked
According to Glassdoor’s India salary and interview data (2024), SQL is the most-tested technical skill in data-related job interviews, appearing in over 67% of junior analyst and developer roles. That number climbs to 82% when you include backend developer positions that touch any relational database.
Freshers are almost always tested on DDL vs DML vs DCL commands first. DDL covers CREATE, ALTER and DROP. DML covers SELECT, INSERT, UPDATE and DELETE. DCL covers GRANT and REVOKE. If you cannot answer this in 30 seconds, the interviewer mentally moves on.
The next mysql interview question is usually about primary keys vs unique keys. A primary key cannot be NULL and there can only be one per table. A unique key can allow one NULL value and a table can have multiple unique keys. That distinction trips up a surprising number of candidates every year.
Whiteboard Query: Find Duplicate Records
This query comes up constantly in SQL query interview question rounds:
SELECT email, COUNT(*) FROM users GROUP BY email HAVING COUNT(*) > 1;
It tests GROUP BY, HAVING and aggregate functions in one line. Practise writing it without looking it up.
MySQL vs Oracle: Key Syntax Differences
| Feature | MySQL | Oracle |
|---|---|---|
| Auto-increment | AUTO_INCREMENT | SEQUENCE + TRIGGER |
| String concatenation | CONCAT(a, b) | a || b |
| Limit rows | LIMIT 10 | ROWNUM <= 10 or FETCH FIRST 10 ROWS |
| Date function | NOW() | SYSDATE |
| Case sensitivity | Case-insensitive by default | Case-sensitive by default |
| Stored procedures | Supported natively | PL/SQL (more powerful) |
| Command | DELETE | TRUNCATE | DROP |
|---|---|---|---|
| Removes rows | Yes (selective) | Yes (all rows) | Yes (entire table) |
| Can be rolled back | Yes | No (in most engines) | No |
| WHERE clause | Supported | Not supported | Not applicable |
| Triggers fired | Yes | No | No |
| Speed | Slower | Faster | Fastest |
Oracle interview questions often go deeper into PL/SQL blocks, cursors and exception handling. If you are targeting product companies or PSUs that run Oracle databases, spend at least two sessions on PL/SQL syntax separately.
If you are also brushing up for analyst roles, the data analyst interview questions guide on 3.0 University covers Python, Excel and statistics questions that pair well with SQL prep.
Joins, Normalisation and Indexing: The Three Pillars of DBMS Viva Questions
These three topics account for roughly 60% of all DBMS viva questions in Indian engineering colleges, based on syllabus patterns across Anna University, VTU and Mumbai University exam boards. Get these right and you are already ahead of most of your batch.
SQL Joins Explained With a Whiteboard Query
An INNER JOIN returns only rows where there is a match in both tables. A LEFT JOIN returns all rows from the left table and matching rows from the right, filling NULLs where there is no match. A RIGHT JOIN does the reverse. A FULL OUTER JOIN returns everything from both tables.
Here is the whiteboard query interviewers love for mysql interview questions rounds:
SELECT e.name, d.department_name FROM employees e LEFT JOIN departments d ON e.dept_id = d.id WHERE d.id IS NULL;
This finds employees who do not belong to any department. It combines LEFT JOIN with a NULL filter, which tests whether you actually understand what LEFT JOIN produces, not just what it is called.
Normalisation: 1NF, 2NF and 3NF Without the Textbook Jargon
First Normal Form (1NF) means every column holds atomic values: no comma-separated lists, no repeating groups. Second Normal Form (2NF) means you have achieved 1NF and every non-key column is fully dependent on the entire primary key, not just part of it. Third Normal Form (3NF) means you have achieved 2NF and no non-key column depends on another non-key column.
A classic viva question: “Give a real-world example of a 2NF violation.” Answer: a table with (StudentID, CourseID, StudentName) where StudentName depends only on StudentID, not on the composite key (StudentID, CourseID). That is a partial dependency, which breaks 2NF.
Boyce-Codd Normal Form (BCNF) comes up in postgraduate vivas and some product company interviews. It is a stricter version of 3NF where every determinant must be a candidate key.
Indexing: Why It Matters and When It Backfires
An index is a data structure, usually a B-tree, that the database engine uses to find rows faster without scanning the entire table. According to the MySQL 8.0 Reference Manual, a full table scan on a million-row table without an index can be 100x slower than the same query using a B-tree index on the filtered column.
The trade-off: indexes speed up SELECT queries but slow down INSERT, UPDATE and DELETE operations because the index has to be updated every time data changes. Do not index every column. Index columns used frequently in WHERE, JOIN ON and ORDER BY clauses.
Whiteboard query to check existing indexes in MySQL:
SHOW INDEX FROM table_name;
Interviewers also ask about composite indexes. A composite index on (last_name, first_name) helps queries filtering by last_name or by both columns, but it will not help a query filtering only by first_name. That is the leftmost prefix rule and it is a common gotcha in SQL query interview questions.
ACID Properties and Transactions
ACID stands for Atomicity, Consistency, Isolation and Durability. Atomicity means a transaction either completes fully or rolls back entirely: no partial updates. Consistency means the database moves from one valid state to another. Isolation means concurrent transactions do not interfere with each other. Durability means committed data survives system failures.
A common viva scenario: “What happens if a bank transfer fails halfway?” The answer is the transaction rolls back due to Atomicity, so neither account is debited or credited incorrectly. MySQL uses InnoDB as its default storage engine specifically because InnoDB supports full ACID compliance, unlike the older MyISAM engine.
Understanding ACID also connects directly to security topics. If you are exploring how data integrity intersects with security engineering, the cybersecurity interview questions guide covers authentication, encryption and access control questions that often appear alongside DBMS topics in full-stack and security-focused roles.
How to Practise MySQL Interview Questions Before the Interview
Knowing theory is not enough. Indian product companies like Flipkart, Swiggy and PhonePe give live SQL rounds where you write queries in real time on platforms like HackerRank or a shared Google Doc. According to HackerRank’s 2023 Developer Skills Report, SQL is the most-assessed skill in technical screening globally, ahead of Python and Java.
Start with these five practice areas in order:
- Basic SELECT with WHERE, ORDER BY and GROUP BY: these appear in 100% of fresher rounds.
- All four JOIN types with at least two tables you have designed yourself.
- Subqueries and correlated subqueries: “Find the second highest salary” is a classic.
- Window functions like RANK(), ROW_NUMBER() and DENSE_RANK() for experienced roles.
- Stored procedures and triggers for Oracle-heavy or backend developer roles.
The “second highest salary” query without using LIMIT is a staple in mysql interview questions rounds:
SELECT MAX(salary) FROM employees WHERE salary < (SELECT MAX(salary) FROM employees);
Practise this until you can write it in under 90 seconds without prompting.
Resources Worth Using This Week
Free platforms like SQLZoo, LeetCode’s Database section and Mode Analytics SQL Tutorial cover 90% of what you will need. For structured certification that employers recognise, check out the courses available at 3.0 University covering data, cybersecurity and programming skills built around real industry requirements.
SQL skills pair well with broader career planning. If you are deciding which technical path fits your goals, the guide on choosing the right career path after graduation in 2026 breaks down salaries, growth trends and skill requirements across IT roles in India.
Students still in college should also read the top skills every college student must learn before graduation to understand where SQL fits in the bigger picture of what Indian employers actually want. And if you are eyeing high-paying roles, the top online courses for high-salary jobs in 2025 lists certifications with verified salary outcomes.
One more link worth bookmarking: if you are considering roles that combine data access with security, understanding what a cybersecurity analyst does will show you how SQL skills apply in threat detection, log analysis and incident response work.
The week before your interview, do not just read. Open a MySQL sandbox (MySQL Workbench is free), create two or three tables, populate them with dummy data and run every query type from memory. That hands-on muscle memory is what separates candidates who get offers from those who knew the theory but struggled on the query.
Frequently Asked Questions
What MySQL interview questions are asked to freshers?
Freshers are typically asked about DDL vs DML commands, primary key vs unique key, basic SELECT queries with WHERE and GROUP BY, simple INNER JOIN scenarios and the difference between DELETE and TRUNCATE. Indian campus placement drives at TCS, Infosys and Cognizant consistently include these mysql interview questions. Expect at least one live query-writing task, so practise writing without IDE autocomplete.
What is the difference between INNER JOIN and LEFT JOIN?
INNER JOIN returns only rows where a match exists in both tables. LEFT JOIN returns all rows from the left table plus matching rows from the right table, placing NULL in columns where no match exists. If you want to find records in one table that have no corresponding record in another, LEFT JOIN with a WHERE IS NULL filter is the standard approach.
What are the normal forms in database design?
First Normal Form (1NF) requires atomic column values and no repeating groups. Second Normal Form (2NF) eliminates partial dependencies on a composite key. Third Normal Form (3NF) eliminates transitive dependencies between non-key columns. BCNF is a stricter variant of 3NF. Most production databases target 3NF, balancing data integrity with query performance rather than pushing to higher normal forms.
How do indexes improve query performance?
Indexes, usually implemented as B-trees in MySQL and Oracle, let the database engine locate rows without scanning every record in the table. The MySQL 8.0 Reference Manual shows index-backed queries can be orders of magnitude faster on large tables. The cost is slower write operations. Index columns used in WHERE clauses, JOIN conditions and ORDER BY statements, and avoid indexing low-cardinality columns like boolean flags.
What DBMS viva questions come up most?
The most common DBMS viva questions cover ACID properties, the differences between DDL and DML, all normalisation forms up to BCNF, types of SQL joins, the difference between a clustered and non-clustered index, and what a foreign key constraint does. In Indian engineering colleges under VTU, Anna University and Mumbai University, expect scenario-based questions where you draw an ER diagram on the board.
How do I prepare for a MySQL interview in one week?
Spend day one on DDL, DML and DCL commands. Day two on all JOIN types with hands-on queries. Day three on normalisation up to BCNF. Day four on indexing and ACID properties. Day five on subqueries and window functions. Days six and seven on timed whiteboard practice using LeetCode’s Database section or SQLZoo. This structured approach covers the core mysql interview questions asked at TCS, Infosys, Wipro and product companies alike.
SQL is a skill that compounds. Every project, internship and certification you add on top of a solid SQL foundation makes you a stronger candidate across data engineering, backend development, business intelligence and cybersecurity roles. If you are ready to build structured, industry-recognised skills beyond SQL, explore 3.0 University’s certification programmes in Cybersecurity, Ethical Hacking, AI, Blockchain and Web3. They are built for students, working professionals and career switchers who want practical skills, not just theory.
Last updated: September 2026. Reviewed by the 3University editorial team.