TGViewer
Data Analytics Data Analytics @sqlspecialist · 111K subscribers
Post #2132 5.6K
15 SQL interview questions for freshers

1) What is SQL and what is it used for?
Answer: SQL is a language for managing and querying relational databases. It’s used to retrieve, insert, update, delete data and to manage schema and permissions.

2) What are the different types of SQL statements?
Answer: DDL (Data Definition Language), DML (Data Manipulation Language), DCL (Data Control Language), and DTL (Transaction Control Language).

3) What is a primary key?
Answer: A unique identifier for each row in a table; cannot be NULL.

4) What is a foreign key?
Answer: A field that creates a link between two tables, enforcing referential integrity.

5) What is the difference between INNER JOIN and LEFT JOIN?
Answer: INNER JOIN returns matching rows from both tables; LEFT JOIN returns all rows from the left table and matched rows from the right table (NULL if no match).

6) What is normalization?
Answer: Organizing data to reduce redundancy by dividing into related tables and defining relationships.

7) What is a database index?
Answer: A data structure that improves the speed of data retrieval; can be on one or more columns.

8) What is GROUP BY and HAVING?
Answer: GROUP BY aggregates rows by column(s); HAVING filters groups after aggregation (unlike WHERE which filters rows before aggregation).

9) What is a subquery?
Answer: A query nested inside another query, used to perform operations that depend on another query’s result.

10) What is a view?
Answer: A saved query that presents data as a virtual table; does not store data itself.

11) What is transaction management?
Answer: Ensuring data integrity using ACID properties; COMMIT to save, ROLLBACK to undo, and SAVEPOINT to set a point to roll back to.

12) What are SQL constraints?
Answer: Rules like PRIMARY KEY, FOREIGN KEY, NOT NULL, UNIQUE, CHECK, and DEFAULT to enforce data integrity.

13) What is the difference between WHERE and HAVING?
Answer: WHERE filters rows before grouping; HAVING filters groups after aggregation.

14) What is a stored procedure?
Answer: A precompiled set of SQL statements stored in the database, can be executed with parameters.

15) What is the difference between UNION and UNION ALL?
Answer: UNION removes duplicates between results; UNION ALL keeps all rows, including duplicates.

💬 React with ❤️ for more! 😊
  • ❤ 21
  • 👏 1
More from @sqlspecialist
  1. Oct 17, 2026Sales Fact ↓ Customer Dimension Product Dimension Date Dimension Region Dimension The fact…
  2. Oct 17, 2026📊 Data Analyst Interview Series — Part 11 Guys, let's continue our Data Analyst Interview…
  3. Oct 17, 2026𝗜𝗕𝗠 𝗙𝗥𝗘𝗘 𝗧𝗘𝗖𝗛 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝟮𝟬𝟮𝟲! 🎓 Explore IBM Cognitive Class and build…
  4. Oct 16, 2026𝗗𝗮𝘁𝗮 𝘀𝗰𝗶𝗲𝗻𝗰𝗲 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗪𝗶𝘁𝗵 𝗔𝗜😍 Future Ready Data Scien…
  5. Oct 14, 2026I could then categorize customers into groups such as Active, At Risk, and Inactive and su…
  6. Oct 14, 2026📊 Data Analyst Interview Series — Part 10 Guys, let's continue our Data Analyst Interview…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →