Tata Consultancy Services Ninja Technical — DBMS Theory and Live SQL
- Field
- Engineering
- Company
- Tata Consultancy Services
- Role
- Assistant System Engineer Trainee (Ninja)
- Duration
- 20 min
- Difficulty
- Medium
- Completions
- New
- Updated
- 2026-06-09
What this round is about
This is the TCS Ninja technical interview — the round that determines whether you get the Ninja profile offer. It runs for 20 minutes and is conducted by a TCS engineer with 3 to 8 years of experience. The interviewer is not trying to trick you. They are asking one question: can you actually write SQL that runs, and do you understand the database concepts behind it? This round covers DBMS theory including normalization, keys, ACID properties, JOIN types, DELETE versus TRUNCATE versus DROP, and indexing, followed by live SQL writing on the whiteboard. The candidate who memorised definitions the night before and the candidate who has actually used a database are indistinguishable until the SQL question arrives.
What strong answers look like
Strong candidates apply normalization to a concrete table — they name the functional dependency and show the split, not just define the forms. On ACID, they give the banking transfer scenario immediately rather than reciting the acronym. On JOINs, they choose the correct type for the use case and explain what happens to unmatched rows. On the SQL whiteboard, they write a query that would actually run: correct clause order, HAVING not WHERE for aggregate filters, DISTINCT in the salary query, and they handle the edge case where two employees share the highest salary. They pace themselves and move on after answering rather than over-explaining.
What weak answers look like (and how to avoid them)
The most common failure is accurate definitions with no application. Saying normalization eliminates redundancy and describing 1NF, 2NF, and 3NF correctly is not enough if you cannot normalise a specific table. Similarly, expanding the ACID acronym perfectly but having no banking example is a red flag. On SQL: writing WHERE COUNT(*) greater than 5 instead of HAVING COUNT(*) greater than 5 will fail silently or produce a syntax error on a real database. Omitting DISTINCT from the second-highest salary query means two employees sharing the top salary will hide the true runner-up. The interviewer does not correct these mistakes — they point at the line and wait. Recognise your own errors.
Pre-interview checklist (2 minutes before you start)
- Can you normalise a student-course-grade table to 3NF out loud right now?
- Can you write SELECT MAX(salary) FROM employee WHERE salary less than (SELECT MAX(salary) FROM employee) without looking it up?
- Can you explain HAVING in one sentence that does not use the word WHERE?
- Do you know what TRUNCATE does to an open transaction?
- Can you draw a Venn diagram showing INNER JOIN vs LEFT JOIN and explain the NULL column on the right side?
How the AI behaves
The AI interviewer plays Arvind Krishnamurthy, a TCS Senior Software Engineer from the Chennai centre. He is professional, calm, and direct. He does not hint or confirm partial answers. If your SQL has a syntax error, he will point at the specific line and say nothing — it is your job to find and fix it. He will push you to the second form of the salary query if you only write one. He moves on after 90 seconds on any theory question. He is not hostile, but he is not your tutor. Treat this exactly as you would treat the real interview.
Common traps in this type of round
- Spending too long on definitions and running out of time before reaching the SQL questions, which carry the most weight
- Writing GROUP BY after HAVING in the clause order, which causes a syntax error
- Using WHERE to filter on COUNT, SUM, AVG, or any other aggregate function
- Forgetting DISTINCT in the LIMIT OFFSET form of the second-highest salary query
- Claiming TRUNCATE is the same as DELETE without a WHERE clause — the critical difference is rollback ability
- Saying an index slows down writes without explaining the mechanical reason of B-tree update on every write
Sample problems you'll face
The 2 problems below are the same ones you'll work through in the live session — no surprises. Read the constraints carefully; the AI persona will refer you to the on-canvas card by problem number.
- 1Second-Highest Salary (SQL)
Given an Employee table with columns id (int) and salary (int), write a single SQL query that returns the second-highest distinct salary, aliased as second_highest. If no second-highest salary exists, the query must return NULL (not an empty result).
Example inputEmployee: id | salary 1 | 100 2 | 200 3 | 300Example outputsecond_highest 200- Distinct salaries only: duplicate values count as one
- Return NULL, not an empty set, when fewer than two distinct salaries exist
- A single SQL statement: no stored procedures or procedural loops
- ANSI SQL; MySQL 8 syntax is acceptable
- Use the on-canvas card to read the prompt; write your query on the whiteboard. The AI sees what you write.
- 2Department-wise Headcount with HAVING (SQL)
Given an Employee table with columns id (int), name (varchar), and dept_id (int), write a SQL query that returns each dept_id with its employee count aliased as headcount, including only departments that have more than 3 employees, ordered by headcount in descending order.
Example inputEmployee dept_id per row: 10, 10, 10, 10, 10, 20, 20, 30, 30, 30, 30Example outputdept_id | headcount 10 | 5 30 | 4- Filter the aggregated count with HAVING, not WHERE
- Include only departments with headcount greater than 3
- Order by headcount in descending order
- Alias the aggregate column as headcount
- Use the on-canvas card to read the prompt; write your query on the whiteboard. The AI sees what you write.
Interview framework
You will be scored on these 5 dimensions. The full rubric with definitions is below.
What we evaluate
Your final scorecard breaks down across these dimensions. The full rubric and tier criteria are revealed inside the interview itself.
- Normalization Application25%
- Live SQL Correctness25%
- Aggregate Filtering Reasoning20%
- JOIN Type Selection15%
- Transaction and Index Depth15%
- DELETE vs TRUNCATE vs DROP Distinction0%
Common questions
Sources this interview is built on
Real candidate-report URLs (Glassdoor / AmbitionBox / PrepInsta / GeeksforGeeks / Medium) reviewed when authoring the questions, persona, and rubric. Verify the realism yourself.
- TCS Ninja Interview Experience Jan 2026 | Final-Year CSE Student - GeeksforGeeksgeeksforgeeks.org
- TCS Ninja Final Interview (All India Campus) | GeeksforGeeksgeeksforgeeks.org
- TCS NINJA Profile Interview Questions | Glassdoorglassdoor.co.in
- TCS Ninja Recruitment Process 2026 for Freshers (Full Guide)unstop.com
- SQL Interview Questions - GeeksforGeeksgeeksforgeeks.org
- Commonly asked DBMS interview questions - GeeksforGeeksgeeksforgeeks.org
- Top 75+ DBMS Interview Questions and Answers (2026 Updated) - InterviewBitinterviewbit.com
- SQL Query to Find Second Highest Salary - GeeksforGeeksgeeksforgeeks.org