Viva answers SQL DBMS
chatgpt.com/c/68ac8509-c550-8327-9d60-a90a6451cae3
Perfect 👍 Thanks for sharing the images earlier. I carefully went through the 3 images
you uploaded. They mostly cover SQL & DBMS fundamentals, commands, keys,
normalization, joins, and constraints.
Here’s a compiled list of viva-style questions (easy, medium, tricky) extracted from
them:
✅ Basics
1. What is SQL?
2. Why do we use SQL?
3. What are the types of SQL commands?
4. What is the difference between DDL, DML, DCL, and TCL?
5. What is the difference between DBMS and RDBMS?
✅ Table & Keys
6. What is a Primary Key? Give an example.
7. What is a Foreign Key? Why is it important?
8. What is the difference between Primary Key and Unique Key?
9. What is a Candidate Key?
10. What is a Composite Key?
11. Can a table have multiple Primary Keys? Why/Why not?
✅ Data Operations
12. Difference between DELETE, TRUNCATE, and DROP.
13. Can we rollback after DELETE? What about TRUNCATE?
14. Difference between WHERE and HAVING.
15. Difference between UPDATE and ALTER.
16. What is the difference between UNION and UNION ALL?
✅ Constraints
17. What are Constraints in SQL?
18. Difference between NOT NULL and CHECK.
19. What does DEFAULT constraint do?
20. Can a table have multiple UNIQUE constraints?
✅ Normalization
21. What is Normalization? Why is it needed?
22. Explain 1NF, 2NF, 3NF with examples.
23. What is Denormalization? Why is it used?
✅ Joins
24. What is a Join? Why do we use it?
25. Difference between INNER JOIN and OUTER JOIN.
26. Explain LEFT JOIN, RIGHT JOIN, FULL JOIN with example.
27. Can we join more than two tables in SQL?
✅ Data Types
28. Difference between CHAR and VARCHAR.
29. Difference between INT and BIGINT.
30. Difference between DATE, DATETIME, and TIMESTAMP.
✅ Advanced
31. What is a View? Why is it used?
32. Difference between View and Table.
33. What is a Stored Procedure?
34. What is a Trigger?
35. What is an Index? Difference between Clustered and Non-clustered index.
36. What is a Subquery? Difference between Correlated and Non-correlated subquery.
✅ Transactions
37. What are ACID properties in DBMS?
38. What is a Transaction?
39. Difference between COMMIT, ROLLBACK, and SAVEPOINT.
✅ Tricky / Commonly Asked
40. Can a table have two Primary Keys?
41. Can a Foreign Key accept NULL values?
42. Is NULL equal to 0? Why not?
43. If we drop a table, what happens to its Views?
44. Can we create a View from multiple tables?
45. What happens if we don’t use WHERE clause in DELETE?
46. Difference between SQL and NoSQL.
47. Difference between Procedural Language (PL/SQL, T-SQL) and SQL.
👉 These are the viva questions extracted + expanded from the 3 images you
uploaded. They cover easy, medium, and tricky levels — exactly what examiners ask in
viva.
Do you want me to now write short, exam-ready answers for each of these (like a viva
handbook), or just keep them as a question bank?
answer of all this question in details
Perfect Ritika 👌 You want detailed answers of all the viva questions I listed from your
3 SQL/DBMS images. I’ll write them clearly, exam-ready, and easy to understand so
you can revise quickly during viva prep.
✅ Detailed Viva Answers (SQL & DBMS)
🔹 Basics
Q1. What is SQL?
SQL (Structured Query Language) is a standard language used to store, manipulate, and
retrieve data from relational databases. It provides commands to create tables, insert,
update, delete, and query data.
Q2. Why do we use SQL?
To communicate with databases.
To create and manage database objects (tables, views, indexes).
To insert, update, delete data.
To retrieve data with conditions and sorting.
To enforce security and integrity using constraints and permissions.
Q3. What are the types of SQL commands?
1. DDL (Data Definition Language) → CREATE, ALTER, DROP, TRUNCATE.
2. DML (Data Manipulation Language) → INSERT, UPDATE, DELETE.
3. DCL (Data Control Language) → GRANT, REVOKE.
4. TCL (Transaction Control Language) → COMMIT, ROLLBACK, SAVEPOINT.
5. DQL (Data Query Language) → SELECT.
Q4. Difference between DDL, DML, DCL, TCL?
DDL → Defines structure (table, schema).
DML → Modifies data inside tables.
DCL → Manages access rights.
TCL → Controls transactions.
Q5. Difference between DBMS and RDBMS?
DBMS: General database system, stores data as files, no relation (e.g., XML, MS
Access).
RDBMS: Stores data in tables with relations using primary key + foreign key (e.g.,
MySQL, Oracle, PostgreSQL).
🔹 Table & Keys
Q6. Primary Key
A column (or set of columns) that uniquely identifies each row.
Cannot be NULL, cannot be duplicate.
Example: StudentID in Student table.
Q7. Foreign Key
A column in one table that refers to Primary Key in another table.
Used to maintain referential integrity.
Example: Course.StudentID → refers to Student.StudentID.
Q8. Primary Key vs Unique Key
Primary Key → only one per table, cannot be NULL, ensures uniqueness.
Unique Key → multiple allowed, NULLs are allowed (but only one NULL per
column in MySQL).
Q9. Candidate Key
All possible keys that can uniquely identify a row.
Example: In Student table → (RollNo, Email) both can uniquely identify students →
both are candidate keys.
Q10. Composite Key
A primary key formed by combining two or more columns.
Example: (OrderID, ProductID) in OrderDetails table.
Q11. Can a table have multiple Primary Keys?
No. A table can have only one primary key, but that key may consist of multiple
columns (composite key).
🔹 Data Operations
Q12. DELETE vs TRUNCATE vs DROP
DELETE → removes specific rows, can rollback.
TRUNCATE → removes all rows, faster, cannot rollback.
DROP → deletes table structure + data permanently.
Q13. Can we rollback after DELETE? TRUNCATE?
DELETE → Yes (before commit).
TRUNCATE → No.
DROP → No.
Q14. WHERE vs HAVING
WHERE → filters rows before grouping.
HAVING → filters groups after aggregation.
Q15. UPDATE vs ALTER
UPDATE → changes data in table.
ALTER → changes table structure (add/drop column).
Q16. UNION vs UNION ALL
UNION → removes duplicates.
UNION ALL → keeps duplicates.
🔹 Constraints
Q17. Constraints
Rules applied to table columns to maintain data integrity.
Types → PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK, DEFAULT.
Q18. NOT NULL vs CHECK
NOT NULL → ensures column cannot have NULL value.
CHECK → ensures column values satisfy condition (e.g., Age > 18).
Q19. DEFAULT constraint
Assigns a default value if no value is given.
Example: CREATE TABLE Student (Status VARCHAR(10) DEFAULT 'Active');
Q20. Can a table have multiple UNIQUE constraints?
Yes. Unlike Primary Key, we can have multiple UNIQUE constraints.
🔹 Normalization
Q21. Normalization
Process of organizing data to reduce redundancy and improve integrity.
Q22. 1NF, 2NF, 3NF
1NF → atomic values only, no repeating groups.
2NF → 1NF + no partial dependency (non-key should depend on whole key).
3NF → 2NF + no transitive dependency.
Q23. Denormalization
Opposite of normalization, introduces redundancy for faster queries.
🔹 Joins
Q24. Join
Combines rows from two or more tables using related columns.
Q25. INNER vs OUTER JOIN
INNER JOIN → returns only matching rows.
OUTER JOIN → returns matching + non-matching rows (NULL filled).
Q26. LEFT, RIGHT, FULL JOIN
LEFT JOIN → all rows from left + matching right.
RIGHT JOIN → all rows from right + matching left.
FULL JOIN → all rows from both sides.
Q27. Can we join more than two tables?
Yes, we can join multiple tables using JOIN clauses.
🔹 Data Types
Q28. CHAR vs VARCHAR
CHAR(n) → fixed length. Pads with spaces if shorter.
VARCHAR(n) → variable length. Saves space.
Q29. INT vs BIGINT
INT → 4 bytes (up to ~2 billion).
BIGINT → 8 bytes (very large numbers).
Q30. DATE vs DATETIME vs TIMESTAMP
DATE → only date.
DATETIME → date + time (no timezone).
TIMESTAMP → date + time with timezone, auto-updates.
🔹 Advanced
Q31. View
A virtual table based on SQL query. Stores no data, just query result.
Q32. View vs Table
Table → physically stores data.
View → stores only query, no data.
Q33. Stored Procedure
Precompiled set of SQL statements stored in DB, reusable.
Q34. Trigger
Special procedure that runs automatically on events (INSERT, UPDATE, DELETE).
Q35. Index (Clustered vs Non-clustered)
Index → improves query speed.
Clustered Index → rearranges table rows physically.
Non-clustered Index → separate structure with pointers.
Q36. Subquery
Query inside another query.
Correlated → depends on outer query.
Non-correlated → independent.
🔹 Transactions
Q37. ACID properties
Atomicity → all or nothing.
Consistency → maintains rules.
Isolation → transactions don’t affect each other.
Durability → changes persist after commit.
Q38. Transaction
A sequence of operations performed as a single unit.
Q39. COMMIT vs ROLLBACK vs SAVEPOINT
COMMIT → makes changes permanent.
ROLLBACK → undo changes.
SAVEPOINT → rollback to a specific point.
🔹 Tricky
Q40. Two Primary Keys? → ❌ No. Only one allowed.
Q41. Foreign Key NULL? → ✅ Yes, foreign key can have NULL (means no reference).
Q42. Is NULL = 0? → ❌ No. NULL = unknown, 0 = value.
Q43. Drop table → Views? → Views become invalid.
Q44. View from multiple tables? → ✅ Yes.
Q45. DELETE without WHERE? → Deletes all rows.
Q46. SQL vs NoSQL
SQL → structured, relational.
NoSQL → unstructured, flexible schema.
Q47. PL/SQL vs SQL
SQL → only query language.
PL/SQL/T-SQL → procedural, supports loops, conditions.
✨ That’s the full viva handbook with detailed answers (47 Qs).
Do you want me to also make a short one-line revision sheet (cheat sheet) from this
for last-minute viva prep?