LTM interviews are structured to evaluate both technical skills and problem-solving. SQL is a core component in these interviews, particularly for data-related roles. It’s a key factor in data science jobs. Candidates can expect in-depth questions about SQL queries, databases, and the manipulation of real-world data.
LTM, formerly known as LTIMindtree, hires for SQL-heavy roles across data analytics, database development, data engineering, and enterprise application support. Interview questions usually test not only SQL syntax but also your ability to write clean queries, explain trade-offs, handle real data issues, and optimize performance.
Why Join LTM?
1: Which of the following algorithms is most suitable for classification tasks?
2: Which metric is generally used to evaluate the performance of a regression model?
3: Which of the following is not a feature scaling method?
4: In machine learning, what is overfitting?
5: Which type of machine learning algorithm is used to predict a continuous output?
Ever wondered how much you really know? It's time to put your brain to the test!
Choosing the right company is crucial for career growth. LTM is a top choice for data science professionals. Here’s why it stands out:
Global Reputation
LTM has a significant global presence in the technology sector. It provides solutions to major global companies. Working here means dealing with cutting-edge technologies. You will gain exposure to diverse global clients and projects.
Strong Focus on Data Science and Analytics
LTM invests heavily in data science and analytics. It offers projects in machine learning, AI, and big data. These areas are the future of technology. LTM provides tools and platforms essential for success.
Learning and Development Opportunities
LTM emphasizes continuous learning and growth. It offers various training programs for employees. You can enhance technical skills and leadership abilities. Internal mobility allows you to explore new roles and technologies.
Work-Life Balance
LTM values work-life balance alongside career growth. It has a flexible work culture and employee-friendly policies. The team focuses on collaboration and innovation. This makes it a great place for a balanced work life.
Growth Opportunities
LTM’s innovation focus ensures constant learning for employees. You can explore new roles and leadership positions. Rapid career advancement is possible here. For technology and data science enthusiasts, the growth potential is immense.
Company Culture
LTM is known for its vibrant and inclusive culture. It nurtures talent and encourages creativity. Employees describe it as collaborative and innovative. This makes it an appealing choice for data science professionals.
Why LTM for Data Science Roles?
For data science professionals, LTM is a great place to work. The company uses advanced data technologies to solve real-world problems. You’ll get the chance to work on data-driven projects across industries. From building predictive models to working with big data, LTM offers a diverse range of experiences.
Why is SQL important in Data Science?
SQL, or Structured Query Language, is a universal language. It’s used to interact with databases, and databases are at the heart of data science. Whether it’s extracting, updating, or analyzing data, SQL handles it all.
In a data science role, you need to know SQL for:
Data retrieval from databases.
Joining multiple datasets for analysis.
Handling large-scale data operations.
Understanding SQL allows you to communicate with data stored in relational databases. Data scientists often use SQL to clean, filter, and aggregate data before modeling.
Top Companies Free SQL Interview Questions and Answers PDF Download
SQL (Structured Query Language) is a standard language used to store, retrieve, update, and manage data in relational databases. It supports querying, data definition, data manipulation, access control, and transaction control.
2. What are the main categories of SQL commands?
DQL:SELECT, used to retrieve data.
DML:INSERT, UPDATE, DELETE, used to modify data.
DDL:CREATE, ALTER, DROP, TRUNCATE, used to define database objects.
DCL:GRANT and REVOKE, used to manage permissions.
TCL:COMMIT, ROLLBACK, and SAVEPOINT, used to manage transactions.
3. What is the difference between DELETE, TRUNCATE, and DROP?
Command
Purpose
WHERE supported?
Typical use
DELETE
Removes selected rows
Yes
Conditional row deletion
TRUNCATE
Removes all rows from a table
No
Fast full-table cleanup
DROP
Removes the table structure and data
No
Permanently removing an object
DELETE is DML and can be rolled back in most database systems when executed within a transaction. TRUNCATE is generally faster because it deallocates data pages rather than logging individual row deletions, but its rollback behavior depends on the database. DROP removes the table definition as well as its data.
4. What is the difference between WHERE and HAVING?
WHERE filters individual rows before grouping. HAVING filters groups after GROUP BY has been applied.
Example:
SELECT department_id, AVG(salary) AS avg_salary
FROM employees
WHERE status = 'Active'
GROUP BY department_id
HAVING AVG(salary) > 70000;
5. What is the difference between UNION, UNION ALL, INTERSECT, and EXCEPT?
UNION combines result sets and removes duplicates.
UNION ALL combines result sets and retains duplicates.
INTERSECT returns rows present in both queries.
EXCEPT returns rows from the first query that are not present in the second.
For performance, use UNION ALL when duplicates are acceptable or impossible, because it avoids the deduplication step.
6. What is the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN?
INNER JOIN: Returns only matching rows from both tables.
LEFT JOIN: Returns all rows from the left table and matching rows from the right table.
RIGHT JOIN: Returns all rows from the right table and matching rows from the left table.
FULL OUTER JOIN: Returns all rows from both tables, with NULL where no match exists.
7. What is the difference between a primary key and a unique key?
A primary key uniquely identifies each row and does not allow NULL values. A unique key also prevents duplicate values but may allow one or more NULL values depending on the database.
A table can have only one primary key, but it can have multiple unique constraints.
8. What is a foreign key?
A foreign key is a column or combination of columns that references a primary key or unique key in another table. It enforces referential integrity by preventing invalid relationships between tables.
9. What is normalization?
Normalization organizes data to reduce redundancy and improve data integrity. It splits data into related tables and uses keys to connect them.
Common normal forms include:
1NF: Atomic column values; no repeating groups.
2NF: 1NF plus no partial dependency on part of a composite key.
3NF: 2NF plus no transitive dependency between non-key attributes.
10. When might you denormalize a database?
Denormalization combines or duplicates data to reduce joins and improve read performance. It is common in reporting databases, data warehouses, and applications with heavy read workloads.
The trade-off is that denormalized data can become inconsistent and requires more effort to maintain.
11. Write a query to find the second-highest salary.
SELECT MAX(salary) AS second_highest_salary
FROM employees
WHERE salary < (
SELECT MAX(salary)
FROM employees
);
A more robust approach using DENSE_RANK() handles ties correctly:
SELECT salary
FROM (
SELECT salary,
DENSE_RANK() OVER (ORDER BY salary DESC) AS salary_rank
FROM employees
) ranked
WHERE salary_rank = 2;
12. How do you find duplicate records in a table?
SELECT email, COUNT(*) AS record_count
FROM users
GROUP BY email
HAVING COUNT(*) > 1;
13. How do you delete duplicates while keeping one record?
WITH ranked_users AS (
SELECT *,
ROW_NUMBER() OVER (
PARTITION BY email
ORDER BY created_at DESC
) AS row_num
FROM users
)
DELETE FROM users
WHERE user_id IN (
SELECT user_id
FROM ranked_users
WHERE row_num > 1
);
The exact delete syntax varies by database, but the ranking logic is widely applicable.
14. How do you find the top 5 customers by revenue?
SELECT customer_id,
SUM(order_amount) AS total_revenue
FROM orders
GROUP BY customer_id
ORDER BY total_revenue DESC
LIMIT 5;
In SQL Server, use:
SELECT TOP 5
customer_id,
SUM(order_amount) AS total_revenue
FROM orders
GROUP BY customer_id
ORDER BY total_revenue DESC;
15. How do you find employees earning more than their department average?
SELECT e.employee_id,
e.name,
e.salary,
e.department_id
FROM employees e
JOIN (
SELECT department_id,
AVG(salary) AS avg_salary
FROM employees
GROUP BY department_id
) d
ON e.department_id = d.department_id
WHERE e.salary > d.avg_salary;
16. How do you calculate a running total?
SELECT order_date,
order_amount,
SUM(order_amount) OVER (
ORDER BY order_date
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
) AS running_total
FROM orders;
17. How do you find the latest transaction for each customer?
SELECT customer_id,
transaction_id,
transaction_date,
amount
FROM (
SELECT *,
ROW_NUMBER() OVER (
PARTITION BY customer_id
ORDER BY transaction_date DESC
) AS row_num
FROM transactions
) t
WHERE row_num = 1;
18. What is the difference between RANK(), DENSE_RANK(), and ROW_NUMBER()?
Function
Tie handling
Example ranks for salaries 100, 100, 90
ROW_NUMBER()
Arbitrary unique sequence
1, 2, 3
RANK()
Ties share a rank; gaps follow
1, 1, 3
DENSE_RANK()
Ties share a rank; no gaps
1, 1, 2
19. How do you calculate month-over-month revenue growth?
WITH monthly_revenue AS (
SELECT DATE_TRUNC('month', order_date) AS month,
SUM(order_amount) AS revenue
FROM orders
GROUP BY DATE_TRUNC('month', order_date)
)
SELECT month,
revenue,
LAG(revenue) OVER (ORDER BY month) AS previous_month_revenue,
ROUND(
(revenue - LAG(revenue) OVER (ORDER BY month))
* 100.0 / NULLIF(LAG(revenue) OVER (ORDER BY month), 0),
2
) AS growth_percentage
FROM monthly_revenue;
20. How do you find customers who placed orders in both January and February?
SELECT customer_id
FROM orders
WHERE DATE_TRUNC('month', order_date) IN
(DATE '2026-01-01', DATE '2026-02-01')
GROUP BY customer_id
HAVING COUNT(DISTINCT DATE_TRUNC('month', order_date)) = 2;
A self join joins a table with itself. It is commonly used for hierarchical data, such as finding an employee’s manager.
SELECT e.name AS employee_name,
m.name AS manager_name
FROM employees e
LEFT JOIN employees m
ON e.manager_id = m.employee_id;
22. What is the difference between an equi-join and a non-equi-join?
An equi-join matches rows using equality, such as a.id = b.id. A non-equi-join uses another comparison operator, such as BETWEEN, <, >, or <>.
23. What is a cross join?
A cross join returns the Cartesian product of two tables: every row from the first table paired with every row from the second table. If table A has 10 rows and table B has 20 rows, the result has 200 rows.
24. How do you identify unmatched records between two tables?
SELECT c.customer_id,
c.name
FROM customers c
LEFT JOIN orders o
ON c.customer_id = o.customer_id
WHERE o.order_id IS NULL;
25. How do you handle duplicate join keys?
Use a deterministic rule to retain one row, such as the latest record:
WITH latest_customers AS (
SELECT *,
ROW_NUMBER() OVER (
PARTITION BY customer_id
ORDER BY updated_at DESC
) AS row_num
FROM customers
)
SELECT *
FROM latest_customers
WHERE row_num = 1;
You can also aggregate duplicate keys before joining, depending on the business requirement.
NULLs and data quality
26. How does SQL treat NULL values?
NULL represents an unknown or missing value, not zero or an empty string. Comparisons with NULL using = or <> return unknown, so use IS NULL or IS NOT NULL instead.
27. What is the difference between NULL, zero, and an empty string?
NULL: Value is unknown or missing.
0: A numeric value.
'': A string with no characters.
These are not interchangeable and can produce different filtering, aggregation, and reporting results.
28. How do you replace NULL values in a query?
Use COALESCE() or IFNULL():
SELECT customer_id,
COALESCE(phone, 'Not provided') AS phone
FROM customers;
COALESCE() returns the first non-NULL value from its arguments.
29. How do you handle invalid or unexpected data in SQL?
Use validation rules such as:
Check for NULL values in mandatory fields.
Validate date ranges and numeric ranges.
Remove exact duplicates.
Standardize text casing and whitespace.
Use referential-integrity checks.
Flag suspicious values instead of silently deleting them.
30. How do you find records with invalid dates?
SELECT *
FROM orders
WHERE order_date IS NULL
OR order_date > CURRENT_DATE
OR order_date < DATE '2000-01-01';
Aggregate functions
31. What aggregate functions does SQL provide?
Common aggregate functions include:
COUNT()
SUM()
AVG()
MIN()
MAX()
STRING_AGG() or equivalent string-aggregation functions
32. What is the difference between COUNT(*), COUNT(column), and COUNT(DISTINCT column)?
COUNT(*): Counts all rows.
COUNT(column): Counts non-NULL values in that column.
SELECT SUM(order_amount) / NULLIF(COUNT(DISTINCT order_id), 0) AS average_order_value
FROM orders;
Using NULLIF() prevents division by zero.
34. How do you calculate a percentage of total?
SELECT category,
SUM(sales) AS category_sales,
ROUND(
SUM(sales) * 100.0
/ SUM(SUM(sales)) OVER (),
2
) AS percentage_of_total
FROM sales
GROUP BY category;
35. How do you calculate a cumulative percentage?
WITH category_sales AS (
SELECT category,
SUM(sales) AS sales
FROM sales
GROUP BY category
)
SELECT category,
sales,
SUM(sales) OVER (ORDER BY sales DESC) AS cumulative_sales,
ROUND(
SUM(sales) OVER (ORDER BY sales DESC) * 100.0
/ SUM(sales) OVER (),
2
) AS cumulative_percentage
FROM category_sales;
Subqueries and CTEs
36. What is a subquery?
A subquery is a query nested inside another query. It can appear in SELECT, FROM, WHERE, or HAVING clauses.
37. What is the difference between a correlated and non-correlated subquery?
A non-correlated subquery runs independently of the outer query. A correlated subquery references columns from the outer query and may execute once per outer row.
38. When should you use EXISTS instead of IN?
Use EXISTS when checking whether at least one matching row exists, especially with large subquery result sets. It often stops scanning once it finds a match.
Use IN when comparing against a small, fixed list of values or a manageable result set.
39. What is a CTE?
A Common Table Expression (CTE) is a named temporary result set defined with WITH. It improves readability and can be referenced multiple times within a query.
WITH active_customers AS (
SELECT *
FROM customers
WHERE status = 'Active'
)
SELECT COUNT(*) AS active_customer_count
FROM active_customers;
40. What is a recursive CTE?
A recursive CTE repeatedly references itself to process hierarchical or sequential data, such as an employee-manager hierarchy, bill of materials, or organizational chart.
It has two parts:
An anchor query that provides the starting rows.
A recursive query that references the CTE and continues until the termination condition is met.
Views, procedures, and transactions
41. What is a view?
A view is a saved SQL query that behaves like a virtual table. It simplifies complex queries, restricts access to selected columns, and provides a consistent reporting interface.
A materialized view stores the query result physically, which can improve read performance but requires refreshing.
42. What is a stored procedure?
A stored procedure is a precompiled set of SQL statements stored in the database. It can accept parameters, contain business logic, improve reuse, and reduce network traffic for repeated operations.
43. What is a trigger?
A trigger is database code that automatically executes in response to events such as INSERT, UPDATE, or DELETE. Triggers are useful for auditing and enforcing rules, but overuse can make systems difficult to debug.
44. What is ACID?
ACID describes transaction properties:
Atomicity: All operations succeed or none do.
Consistency: Data remains valid according to defined rules.
Isolation: Concurrent transactions do not interfere unexpectedly.
Durability: Committed changes survive system failures.
45. What are transaction isolation levels?
Common isolation levels are:
Read uncommitted
Read committed
Repeatable read
Serializable
Higher isolation reduces concurrency anomalies but can reduce performance through locking or blocking.
Performance and optimization
46. How do you optimize a slow SQL query?
Start by identifying the actual bottleneck:
Review the execution plan.
Check whether useful indexes are being used.
Avoid SELECT *; retrieve only required columns.
Filter early using selective WHERE conditions.
Avoid functions on indexed columns when possible.
Reduce unnecessary joins and subqueries.
Use EXISTS, window functions, or CTEs where appropriate.
Check table statistics and data volume.
47. What is an index and when can it hurt performance?
An index is a data structure that speeds up data retrieval. It helps with filtering, sorting, and join operations.
Indexes can slow down INSERT, UPDATE, and DELETE operations because the index must be maintained. They also consume storage, so unnecessary indexes should be avoided.
48. What is the difference between a clustered and non-clustered index?
A clustered index determines the physical order of rows in a table; a table generally has only one clustered index. A non-clustered index stores a separate structure with pointers to the table rows; a table can have multiple non-clustered indexes.
The exact implementation varies by database engine.
Data engineering and case questions
49. How would you load only new or changed records from a source table?
Use an incremental-load strategy based on a reliable change indicator, such as updated_at, a change-data-capture field, or a watermark table storing the last successful extraction time.
SELECT *
FROM source_orders
WHERE updated_at > :last_successful_load_time;
For robust pipelines, also validate primary keys, handle late-arriving updates, maintain audit columns, and reconcile record counts after loading.
50. You have an orders table and a customers table. How would you calculate monthly active customers, revenue, and average order value?
WITH monthly_orders AS (
SELECT
DATE_TRUNC('month', o.order_date) AS order_month,
o.customer_id,
o.order_id,
o.order_amount
FROM orders o
WHERE o.order_status = 'Completed'
)
SELECT
order_month,
COUNT(DISTINCT customer_id) AS active_customers,
SUM(order_amount) AS total_revenue,
ROUND(
SUM(order_amount) * 1.0
/ NULLIF(COUNT(DISTINCT order_id), 0),
2
) AS average_order_value
FROM monthly_orders
GROUP BY order_month
ORDER BY order_month;
This type of question tests whether you can translate a business requirement into correct SQL, handle date grouping, avoid duplicate counting, and use safe division. Current LTM interview guidance also highlights window functions, query optimization, incremental loading, and translating SQL logic into PySpark for data-engineering roles.
Write joins, aggregations, CTEs, and window functions without relying on a cheat sheet.
Explain RANK(), DENSE_RANK(), and ROW_NUMBER() with an example.
Handle duplicates, NULLs, date filters, and division-by-zero issues.
Explain indexes, execution plans, and query optimization.
Discuss transactions, ACID, and isolation levels.
Solve business questions involving revenue, retention, customer activity, and top-N analysis.
Adapt SQL syntax to the target database, especially SQL Server, PostgreSQL, MySQL, and Oracle.
Use the company’s current name—LTM Limited, formerly LTIMindtree—when researching roles or referring to interview experiences, while noting that many older resources still use “Mindtree” or “LTIMindtree.”
🚀 Master Power BI with Free MCQs & Tutorials!
Learn, practise, and build your data skills at zero cost, from beginner basics to interview-ready concepts.
SQL remains one of the most important skills for candidates applying to LTM (formerly LTIMindtree/Mindtree), whether the role is Data Analyst, SQL Developer, Database Engineer, or Data Engineer. Interviews typically go beyond definitions and test your ability to write accurate queries, explain your approach, handle real-world data issues, and optimize performance.
The strongest preparation strategy is to combine SQL theory with hands-on practice. Focus on joins, aggregations, subqueries, CTEs, window functions, date analysis, NULL handling, indexing, and query optimization. For data-engineering roles, also prepare for incremental loading, data-quality checks, reconciliation, and translating SQL logic into PySpark.
Practice solving business problems such as finding the second-highest salary, identifying duplicate records, calculating month-over-month growth, ranking customers by revenue, and finding the latest transaction per customer. Being able to explain why you chose a particular query approach is often as important as producing the correct result.
SQL is usually essential, but it is rarely the only requirement. Candidates should also be comfortable with Excel, data visualization tools such as Power BI or Tableau, basic statistics, and business-analysis skills.
Which SQL topics are most important for LTM interviews?
Prioritize joins, GROUP BY, HAVING, subqueries, CTEs, window functions, date functions, NULL handling, indexes, and query optimization. Practical questions involving revenue, customer activity, duplicates, rankings, and running totals are especially common.
Should freshers learn advanced SQL?
Yes. Freshers should first master core SQL, then learn intermediate concepts such as CTEs, window functions, subqueries, and query optimization. Advanced database administration topics are more important for specialized database or backend roles.
What SQL questions are commonly asked in interviews?
Common questions include:
Find the second-highest salary.
Find duplicate records.
Find the top N customers by revenue.
Calculate month-over-month growth.
Find the latest record for each customer.
Identify employees earning above their department average.
Explain the difference between RANK(), DENSE_RANK(), and ROW_NUMBER().
Optimize a slow query.
What is the difference between WHERE and HAVING?
WHERE filters rows before grouping, while HAVING filters grouped results after GROUP BY. Use WHERE for row-level conditions and HAVING for aggregate conditions such as HAVING COUNT(*) > 1.
What role do SQL Joins play in Mindtree’s technical interviews?
SQL Joins are a major focus at Mindtree. Candidates must master inner, outer, cross, and self-joins. These concepts are often tested.
How should candidates prepare for Mindtree's SQL interview?
Prepare by practicing SQL queries and database theory. Review performance optimization and real-world problem-solving. Practice is essential for success.
Famida is an experienced educator with over a decade of teaching experience, specializing in grades 8 to 12, business management (BBM), and electronics engineering. Holding a Master's degree in Electronics and Communication Engineering, she has also trained interns in IoT. For the past four years, Famida has been writing articles for Entri, focusing on exam preparation tips, question papers, and study plans. She also creates practice questions for the Entri app and provides support to users. Additionally, Famida's writing skills extend to parenting and personal blogs, as well as curriculum development.