Infosys | SQL / Database Developer
Infosys SQL Interview Questions
Infosys SQL interviews test normalization theory, stored procedures, triggers, indexing strategies, and complex query writing. Expect 2 technical rounds and one managerial round with scenario-based database design questions.
Foundation Questions - Guaranteed to Appear
1
Explain database normalization up to 3NF with examples.
1NF: atomic values (no repeating groups), primary key exists. 2NF: 1NF + no partial dependencies (every non-key column depends on the entire primary key — relevant for composite PKs). 3NF: 2NF + no transitive dependencies. Example violation: Employee(EmpID, Dept, DeptHead) — DeptHead depends on Dept, not EmpID. Fix: Employee(EmpID, Dept) and Department(Dept, DeptHead).
2
What are stored procedures and their advantages at Infosys?
Precompiled SQL statements stored in the database and executed as a unit. Advantages: Performance (query plan compiled once and cached, reducing parse time on repeated calls), Security (grant EXECUTE without exposing table permissions), Reusability (business logic centralized, callable from Java/.NET), Network reduction (one call executes multiple SQL statements). At Infosys BPM, stored procedures encapsulate ETL logic callable by multiple application teams without duplicating SQL code.
3
Explain the difference between a Trigger and a Stored Procedure.
Stored procedure is explicitly called by an application or scheduler. Trigger fires automatically on INSERT, UPDATE, or DELETE events on a table — cannot be called directly. AFTER trigger: fires post-operation, commonly used for audit logs. INSTEAD OF trigger: overrides the DML operation, used on Views. At Infosys, AFTER INSERT triggers automatically write audit records ensuring 100% audit coverage without application code changes. Cascading triggers (trigger A fires trigger B) are dangerous and banned in many Infosys coding standards.
4
Write SQL to find employees who earn more than their manager.
SELECT e.employee_name, e.salary AS emp_salary, m.salary AS mgr_salary
FROM employees e
JOIN employees m ON e.manager_id = m.employee_id
WHERE e.salary > m.salary;
This self-join compares each employee to their manager in the same table. Follow-up: include department name by adding a JOIN to the departments table on e.department_id.
5
What is a transaction in SQL? Explain ACID properties with examples.
A transaction is a logical unit of work that completes entirely or not at all. Atomicity: all statements succeed together or all rollback (bank transfer debit + credit must both succeed). Consistency: database moves from one valid state to another. Isolation: concurrent transactions do not interfere — controlled by isolation levels (READ COMMITTED, REPEATABLE READ, SERIALIZABLE). Durability: committed changes survive crashes via write-ahead logging. Commands: BEGIN TRANSACTION, COMMIT, ROLLBACK, SAVEPOINT.
6
What is a deadlock in SQL Server and how do you prevent it?
Deadlock: two transactions each hold a lock the other needs, causing indefinite waiting. SQL Server detects deadlocks and kills the transaction with lower deadlock priority. Prevention strategies: 1) Always access tables in the same order across all transactions. 2) Keep transactions short. 3) Use row-level locking. 4) Use READ COMMITTED SNAPSHOT isolation (RCSI) which uses row versioning to eliminate read-write deadlocks — the standard at Infosys production databases.
Practice With Live AI Interview Simulator
GhostMode AI simulates real Infosys interviewers - ask follow-ups, get scored, and receive feedback on your answers in real-time.
Start AI Mock Interview
Start Free Prep