TGViewer
Data Analyst Interview Resources Data Analyst Interview Resources @dataanalystinterview · 52.5K subscribers
Post #734 2K
SQL Interview Questions which can be asked in a Data Analyst Interview.

1️⃣ What is difference between Primary key and Unique key?

◼Primary key- A column or set of columns which uniquely identifies each record in a table. It can't contain null values and only one primary key
can exist in a table.

◼Unique key-Similar to primary key it also uniquely identifies each record in a table and can contain null values.Multiple Unique key can exist in a table.

2️⃣ What is a Candidate key?

◼A key or set of keys that uniquely identifies each record in a table.It is a combination of Primary and Alternate key.

3️⃣ What is a Constraint?

◼Specific rule or limit that we define in our table. E.g - NOT NULL,AUTO INCREMENT

4️⃣ Can you differentiate between TRUNCATE and DELETE?

◼TRUNCATE is a DDL command. It deletes the entire data from a table but preserves the structure of table.It doesn't deletes the data row by row hence faster than DELETE command, while DELETE is a DML command and it deletes the entire data based on specified condition else deletes the entire data,also it deletes the data row by row hence slower than TRUNCATE command.

5️⃣ What is difference between 'View' and 'Stored Procedure'?

◼A View is a virtual table that gets data from the base table .It is basically a Select statement,while Stored Procedure is a sql statement or set of sql statement stored on database server.

6️⃣ What is difference between a Common Table Expression and temporary table?

◼CTE is a temporary result set that is defined within execution scope of a single SELECT ,DELETE,UPDATE statement while temporary table is stored in TempDB and gets deleted once the session expires.

7️⃣ Differentiate between a clustered index and a non-clustered index?

◼ A clustered index determines physical ordering of data in a table and a table can have only one clustered index while a non-clustered index is analogous to index of a book where index is stored at one place and data at other place and index will have pointers to storage location of the data,a table can have more than one non-clustered index.

8️⃣ Explain triggers ?

◼They are sql codes which are automatically executed in response to certain events on a table.They are used to maintain integrity of data.
  • 👏 1
More from @dataanalystinterview
  1. Oct 17, 2026𝗜𝗕𝗠 𝗙𝗥𝗘𝗘 𝗧𝗘𝗖𝗛 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝟮𝟬𝟮𝟲! 🎓 Explore IBM Cognitive Class and build…
  2. Oct 16, 2026𝗗𝗮𝘁𝗮 𝘀𝗰𝗶𝗲𝗻𝗰𝗲 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗪𝗶𝘁𝗵 𝗔𝗜😍 Future Ready Data Scien…
  3. Oct 13, 2026✅ Complete Roadmap to Learn SQL (Structured Query Language) 🧠💻 Week 1: SQL Basics - What…
  4. Oct 13, 2026𝗧𝗢𝗣 𝗙𝗥𝗘𝗘 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝗧𝗢 𝗕𝗢𝗢𝗦𝗧 𝗬𝗢𝗨𝗥 𝗦𝗞𝗜𝗟𝗟𝗦 𝗜𝗡 𝟮𝟬𝟮𝟲! Explor…
  5. Oct 12, 2026🚀 𝗪𝗵𝗶𝗰𝗵 𝗧𝗲𝗰𝗵 𝗦𝗸𝗶𝗹𝗹 𝗪𝗶𝗹𝗹 𝗬𝗼𝘂 𝗠𝗮𝘀𝘁𝗲𝗿 𝗶𝗻 𝟮𝟬𝟮𝟲? Want to buil…
  6. Oct 9, 2026✅SQL Roadmap: Step-by-Step Guide to Master SQL 🧠💻 Whether you're aiming to be a backend…
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 →