SQL_Server_50_Basic_to_Moderate_Questions
SQL_Server_50_Basic_to_Moderate_Questions
Q: What is a database?
Q: What is a table?
A: A key used to link two tables together by referencing a primary key in another table.
Q: What is a constraint?
Q: What is normalization?
Q: What is denormalization?
Q: What is an index?
Q: What is a view?
A: Joins combine rows from two or more tables based on related columns.
A: Returns all rows from the left table, and matched rows from the right table.
SQL Server Interview Questions and Answers
A: Returns all rows from the right table, and matched rows from the left table.
A: A self join is a regular join but the table is joined with itself.
Q: What is a trigger?
A: A special type of stored procedure that automatically executes when an event occurs.
A: `DELETE` removes rows with logging and conditions; `TRUNCATE` removes all rows quickly without logging.
Q: What is a transaction?
A: Groups rows that have the same values into summary rows.
SQL Server Interview Questions and Answers
Q: What is a subquery?
A: Tables created using `#` that exist temporarily during the session.
A: A variable that holds table data and exists for the batch duration.
A: Temp tables support indexing/stats; table variables are faster for small sets.
Q: What is a schema?
Q: What is a synonym?
Q: What is a CTE?
A: A Common Table Expression is a temporary result set used in a SELECT, INSERT, etc.
A: `ISNULL` returns a specified value for NULL, `COALESCE` returns the first non-NULL among arguments.
A: `WHERE` filters rows before grouping; `HAVING` filters groups after aggregation.
A: `SUM`, `AVG`, `MAX`, `MIN`, `COUNT` - used to calculate values from sets of rows.
Q: What is indexing?
A: Sorts and stores table data rows in the order of the key.
A: A structure separate from the data rows that contains pointers to the data.
A: Prevents the message indicating the number of rows affected from being returned.
A: A tool for configuring, managing, and administering all components within SQL Server.
A: Ensures all values in a column are different and allows one NULL.