SQL Server Interview Topic 2: CRUD and Query Basics
This topic checks whether you can read and change table data safely. A full stack developer uses these SQL basics when building API screens like student list, student details, edit student, and delete student.
You should be able to explain SELECT, WHERE, INSERT, UPDATE, DELETE, ORDER BY, TOP, DISTINCT, LIKE, IN, and BETWEEN using simple table examples.
Q9. What is CRUD in SQL Server?โ
Quick interview answer:
CRUD means Create, Read, Update, and Delete. In SQL Server, INSERT creates data, SELECT reads data, UPDATE changes data, and DELETE removes data. Most backend API screens are built around these four operations.
Study in detail: Insert Data, Select and Where, and Update and Delete - These lessons explain each CRUD operation with practice SQL.
Q10. What is SELECT used for?โ
Quick interview answer:
SELECT is used to read data from a table. We can select all columns or only the columns needed by the screen. For example, a student list screen may need only student id, name, class, and mobile number.
Study in detail: Select and Where - This article shows how to read data from tables step by step.
Q11. What is WHERE used for?โ
Quick interview answer:
WHERE filters rows before SQL Server returns the result. It helps us read only the rows we need. For example, we can get only active students or only students from one class.
Study in detail: Select and Where - This article explains filtering with simple School Management examples.
Q12. What is INSERT used for?โ
Quick interview answer:
INSERT adds a new row into a table. In a backend API, when a user submits a new student form, the API can use INSERT to save that student in SQL Server.
Study in detail: Insert Data - This article shows how to insert one row and multiple rows safely.
Q13. What is UPDATE used for?โ
Quick interview answer:
UPDATE changes existing rows in a table. We should normally use WHERE with UPDATE, otherwise SQL Server may update every row in the table. For example, we can update only one student's mobile number using StudentId.
Study in detail: Update and Delete - This article explains how to update records safely.
Q14. What is DELETE used for?โ
Quick interview answer:
DELETE removes rows from a table. We should use WHERE with DELETE when removing specific rows. Without WHERE, all rows in the table can be deleted.
Study in detail: Update and Delete - This article explains delete operations and safety checks.
Q15. What is the difference between DELETE, TRUNCATE, and DROP?โ
Quick interview answer:
DELETE removes selected rows or all rows from a table. TRUNCATE quickly removes all rows but keeps the table structure. DROP removes the table itself, including its structure.
Study in detail: Update and Delete - This article explains when each command is used and why DROP must be handled carefully.
Q16. What are ORDER BY and TOP used for?โ
Quick interview answer:
ORDER BY sorts the result, and TOP limits how many rows are returned. For example, we can show the top 10 students by marks or sort students alphabetically by name.
Study in detail: Order By and Top - This article shows sorting and limiting records with easy examples.
Q17. What are DISTINCT, LIKE, IN, and BETWEEN used for?โ
Quick interview answer:
DISTINCT removes duplicate values from the result. LIKE searches text patterns, IN checks a value against a list, and BETWEEN checks a value inside a range. These are common in search and filter screens.
Study in detail: Select and Where - This article expands filtering conditions with practical examples.
Practice Before Next Topicโ
Write queries for these tasks:
- Insert three students into the
Studenttable. - Select only students from one class.
- Update one student's mobile number using
StudentId. - Delete one test student using
StudentId. - Show the top 5 students by marks.
When explaining CRUD, mention safety. Interviewers like answers that include correct SQL plus warnings about missing WHERE conditions.