KEMBAR78
TCS SQL Interview Questions 50 | PDF | Database Index | Sql
0% found this document useful (0 votes)
70 views5 pages

TCS SQL Interview Questions 50

The document lists the top 50 SQL interview questions commonly asked by TCS, covering fundamental concepts such as SQL commands, keys, joins, normalization, and transactions. It includes definitions and differences between various SQL elements like DDL, DML, and types of joins, as well as functions and operators. The content serves as a comprehensive guide for preparing for SQL interviews.

Uploaded by

anillohar7972
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views5 pages

TCS SQL Interview Questions 50

The document lists the top 50 SQL interview questions commonly asked by TCS, covering fundamental concepts such as SQL commands, keys, joins, normalization, and transactions. It includes definitions and differences between various SQL elements like DDL, DML, and types of joins, as well as functions and operators. The content serves as a comprehensive guide for preparing for SQL interviews.

Uploaded by

anillohar7972
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Top 50 SQL Interview Questions - TCS

1. What is SQL?

SQL (Structured Query Language) is used to communicate with and manipulate databases.

2. What are the types of SQL commands?

DDL, DML, DCL, TCL, and DQL.

3. What is the difference between DDL and DML?

DDL defines structure (e.g., CREATE), DML manipulates data (e.g., INSERT).

4. What is a primary key?

A unique identifier for a record in a table. Cannot be NULL.

5. What is a foreign key?

A field that refers to the primary key in another table.

6. What is a unique key?

It ensures all values in a column are unique but allows one NULL.

7. What is the difference between WHERE and HAVING?

WHERE filters rows before grouping, HAVING filters after grouping.

8. What is normalization?

The process of organizing data to reduce redundancy.

9. What are the types of normalization?

1NF, 2NF, 3NF, BCNF.

10. What is a join?

Combining rows from two or more tables based on related columns.

11. What are the types of joins?

INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, SELF JOIN.
12. What is an INNER JOIN?

Returns records that have matching values in both tables.

13. What is a LEFT JOIN?

Returns all records from the left table and matched ones from the right.

14. What is a RIGHT JOIN?

Returns all records from the right table and matched ones from the left.

15. What is a FULL JOIN?

Returns all records when there is a match in one of the tables.

16. What is a SELF JOIN?

A join where a table is joined with itself.

17. What is a subquery?

A query within another query.

18. What is a correlated subquery?

A subquery that depends on the outer query.

19. What is an index?

Improves the speed of data retrieval operations.

20. What are the types of indexes?

Clustered and Non-clustered.

21. What is a clustered index?

Stores data rows in order based on the key values.

22. What is a non-clustered index?

Stores index separately from the data.

23. What is a view?


A virtual table based on the result of a SELECT query.

24. What is a stored procedure?

A saved collection of SQL statements to be reused.

25. What is a trigger?

A SQL code that automatically runs in response to an event on a table.

26. What is a constraint?

Rules applied on columns to enforce data integrity.

27. What are the types of constraints?

NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK, DEFAULT.

28. What is the difference between DELETE and TRUNCATE?

DELETE removes rows with WHERE; TRUNCATE removes all rows without logging.

29. What is the difference between DROP and TRUNCATE?

DROP removes the table structure; TRUNCATE removes only data.

30. What is the use of GROUP BY?

Groups rows with the same values into summary rows.

31. What is the use of ORDER BY?

Sorts the result set by specified column(s).

32. What is a NULL value?

A NULL represents missing or undefined data.

33. How do you handle NULLs in SQL?

Using IS NULL or IS NOT NULL conditions.

34. What is COALESCE()?

Returns the first non-null value in the list.


35. What is the difference between CHAR and VARCHAR?

CHAR is fixed-length, VARCHAR is variable-length.

36. What is the BETWEEN operator?

Used to filter the result within a range.

37. What is the IN operator?

Used to match a value against a list of values.

38. What is the LIKE operator?

Used for pattern matching in a WHERE clause.

39. What are wildcards in SQL?

'%' matches multiple characters, '_' matches a single character.

40. What is the CASE statement?

Similar to IF-ELSE, returns values based on conditions.

41. What is a transaction?

A unit of work performed against a database.

42. What are the properties of a transaction?

ACID - Atomicity, Consistency, Isolation, Durability.

43. What are COMMIT and ROLLBACK?

COMMIT saves a transaction; ROLLBACK undoes changes.

44. What is a cursor?

A database object used to retrieve a row at a time.

45. What is the difference between UNION and UNION ALL?

UNION removes duplicates; UNION ALL includes all.

46. What is EXISTS?


Checks if a subquery returns any result.

47. What is a temporary table?

A short-term table that exists temporarily during the session.

48. What is the RANK() function?

Gives a unique rank to rows with gaps in ranking.

49. What is the DENSE_RANK() function?

Ranks rows with no gaps in ranking.

50. What is the difference between SQL and PL/SQL?

SQL is a query language; PL/SQL is a procedural language used in Oracle.

You might also like