MySQL + SQL · Lesson 126
MySQL Viva and Practice Questions
Viva Preparation
In a DBMS practical viva, the examiner asks quick questions about your project and basic concepts. Short, confident, correct answers score the most. Below are the most commonly asked questions with model answers.
Basic Questions
| Question | Model Answer |
|---|---|
| What is DBMS? | Software to create, store, manage and retrieve data from a database — e.g. MySQL. |
| What is a primary key? | A column that uniquely identifies each row; it cannot be NULL or duplicate. |
| What is a foreign key? | A column that refers to the primary key of another table to create a relationship. |
| What is a candidate key? | Any column (or set) that can qualify as a primary key. |
| What are ACID properties? | Atomicity, Consistency, Isolation, Durability — they make transactions reliable. |
SQL Questions
| Question | Model Answer |
|---|---|
| Difference between DROP and DELETE? | DELETE removes rows (can use WHERE, can rollback). DROP removes the whole table structure. |
| Difference between DELETE and TRUNCATE? | DELETE removes selected rows and can rollback. TRUNCATE removes all rows quickly and usually cannot rollback. |
| What is a JOIN? | A JOIN combines rows from two or more tables based on a related column. |
| Which constraint stops duplicate emails? | The UNIQUE constraint. |
| How do you find the topper? | Use ORDER BY marks DESC LIMIT 1. |
SQL
-- find the topper SELECT name, marks FROM students ORDER BY marks DESC LIMIT 1; -- a JOIN example SELECT s.name, o.item FROM students s JOIN orders o ON s.roll_no = o.student_id;
Design Questions
| Question | Model Answer |
|---|---|
| What is normalization? | Organising tables to remove redundancy and keep data consistent (1NF, 2NF, 3NF, BCNF). |
| What is an ER diagram? | A diagram showing entities, their attributes and relationships before building tables. |
| What is referential integrity? | A rule ensuring a foreign key always points to a valid existing primary key. |
Viva Tips
💡 How to score well
- Know your own project schema — tables, keys and one JOIN query.
- Answer in one clear sentence; do not over-explain.
- Be ready to run a query live and read its output aloud.
⚠️ Common slip
Don't confuse DROP (removes the table) with DELETE (removes rows). Examiners love this question.
Summary
- Master basics: DBMS, primary/foreign/candidate keys, ACID.
- Know key SQL differences: DROP vs DELETE vs TRUNCATE, and JOINs.
- Understand design: normalization, ER diagram, referential integrity.
- Answer briefly and be ready to run your own queries live.
Frequently Asked Questions
What questions are asked in a DBMS viva?
Common DBMS viva questions cover primary and foreign keys, ACID properties, the difference between DROP, DELETE and TRUNCATE, JOINs, normalization, and questions about your own project schema.
What is the difference between DROP and DELETE?
DELETE removes rows from a table and can use a WHERE clause and be rolled back. DROP removes the entire table structure along with its data.
How do I find the topper in SQL?
Use SELECT name, marks FROM students ORDER BY marks DESC LIMIT 1; this sorts by marks in descending order and returns the highest.
💻 Live Code Editor
This page's programs are ready here — run them, edit them, and learn. No installation needed.
Powered by OneCompiler. The code loads into the editor automatically — press Run to see the output. If the editor does not open, open it in a new tab.