TGViewer
SQL Programming Resources SQL Programming Resources @sqlanalyst · 76.7K subscribers
Post #2241 3.53K
Core SQL Interview Questions. With answers

1 What is SQL
• SQL stands for Structured Query Language
• You use it to read and manage data in relational databases
• Used in MySQL, PostgreSQL, SQL Server, Oracle

2 What is an RDBMS
• Relational Database Management System
• Stores data in tables with rows and columns
• Uses keys to link tables
• Example. Customer table linked to Orders table using customer_id

3 What is a table
• Structured storage for data
• Rows are records
• Columns are attributes
• Example. One row equals one customer

4 What is a primary key
• Uniquely identifies each row
• Cannot be NULL
• No duplicate values
• Example. user_id in users table

5 What is a foreign key
• Links one table to another
• Refers to a primary key in another table
• Allows duplicate values
• Example. user_id in orders table

6 Difference between primary key and foreign key
• Primary key ensures uniqueness
• Foreign key ensures relationship
• One table can have one primary key
• One table can have multiple foreign keys

7 What is NULL
• Represents missing or unknown value
• Not equal to zero or empty string
• Use IS NULL or IS NOT NULL to check

8 What are constraints
• Rules applied on columns
• Maintain data quality
• Common constraints
– NOT NULL
– UNIQUE
– PRIMARY KEY
– FOREIGN KEY
– CHECK

9 What are data types
• Define type of data stored
• Common types
– INT for numbers
– VARCHAR for text
– DATE for dates
– FLOAT or DECIMAL for decimals

10 Interview tip you must remember
• Always explain with a small example
• Speak logic before syntax
• Keep answers short and direct

Double Tap ❤️ For More
  • ❤ 11
More from @sqlanalyst
  1. Oct 13, 2026SQL Interview Series — Part 8 📌 Question 8: Find Customers Who Have Never Placed an Order…
  2. Oct 13, 2026𝗧𝗢𝗣 𝗙𝗥𝗘𝗘 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝗧𝗢 𝗕𝗢𝗢𝗦𝗧 𝗬𝗢𝗨𝗥 𝗦𝗞𝗜𝗟𝗟𝗦 𝗜𝗡 𝟮𝟬𝟮𝟲! Explor…
  3. Oct 12, 2026SQL Interview Series — Part 6 📌 Question 6: Find the Top 2 Highest-Paid Employees in Each…
  4. Oct 12, 2026🚀 𝗪𝗵𝗶𝗰𝗵 𝗧𝗲𝗰𝗵 𝗦𝗸𝗶𝗹𝗹 𝗪𝗶𝗹𝗹 𝗬𝗼𝘂 𝗠𝗮𝘀𝘁𝗲𝗿 𝗶𝗻 𝟮𝟬𝟮𝟲? Want to buil…
  5. Oct 9, 2026SQL Interview Series — Part 5 📌 Question 5: Find Employees Who Earn More Than Their Manag…
  6. Oct 9, 2026🇮🇳 𝗚𝗢𝗩𝗘𝗥𝗡𝗠𝗘𝗡𝗧 𝗢𝗙 𝗜𝗡𝗗𝗜𝗔 — 𝗔𝗜𝗖𝗧𝗘 𝗜𝗡𝗧𝗘𝗥𝗡𝗦𝗛𝗜𝗣𝗦 𝟮𝟬𝟮𝟲 🚀…
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 →