Frequently Asked Questions about SQL and its associated Microsoft technologies.
General SQL
What is SQL?
SQL (Structured Query Language) is a standard language for managing and manipulating databases. It's used to communicate with a database. SQL is used to perform tasks such as updating data, deleting data, and querying data.
What are the main SQL commands?
The main SQL commands fall into categories:
- DDL (Data Definition Language): CREATE, ALTER, DROP
- DML (Data Manipulation Language): SELECT, INSERT, UPDATE, DELETE
- DCL (Data Control Language): GRANT, REVOKE
- TCL (Transaction Control Language): COMMIT, ROLLBACK, SAVEPOINT
What is a database schema?
A database schema is the blueprint or structure of a database. It defines how data is organized and how the relations among them are associated. It includes tables, columns, data types, primary keys, foreign keys, and other constraints.
Microsoft SQL Server Specifics
What is Microsoft SQL Server?
Microsoft SQL Server is a relational database management system developed by Microsoft. It's a popular choice for enterprise-level applications, offering a wide range of features for data storage, retrieval, and management.
What are stored procedures?
Stored procedures are a set of SQL statements and procedural logic that are stored in the database. They can be executed by calling the procedure name, offering benefits like improved performance, security, and reusability.
Example:
CREATE PROCEDURE GetCustomerOrders
@CustomerID INT
AS
BEGIN
SELECT OrderID, OrderDate, TotalAmount
FROM Orders
WHERE CustomerID = @CustomerID;
END;
What are triggers in SQL Server?
Triggers are special stored procedures that automatically execute in response to certain events on a particular table or view in a database. They are often used to enforce business rules, maintain data integrity, or audit data changes.
What is T-SQL?
T-SQL (Transact-SQL) is Microsoft's proprietary extension to SQL used by Microsoft SQL Server. It adds procedural programming, local variables, various support functions for data manipulation, and enhancements for creating and managing database objects.
Advanced Topics
What is Normalization?
Normalization is a database design technique used to organize data to reduce redundancy and improve data integrity. It involves dividing larger tables into smaller, less redundant tables and defining relationships between them.
What is a Transaction?
A transaction is a sequence of database operations performed as a single logical unit of work. Transactions are atomic, consistent, isolated, and durable (ACID), ensuring data integrity even in the event of errors or system failures.