An introductory guide to setting up Microsoft SQL Server, understanding SSMS, and running essential SQL queries.
What is SQL Server?
SQL Server is a Database Management System (DBMS) developed by Microsoft. It is used to store and manage data securely.
Many organizations rely on SQL Server every day, including:
What is SSMS?
SSMS (SQL Server Management Studio) is the software that allows us to interact with SQL Server. Using SSMS, we can:
- Create databases and create tables
- Insert data and retrieve data
- Update records and delete records
- Backup databases and restore databases
1. What is Microsoft SQL Server?
2. Why do we install SSMS (SQL Server Management Studio)?
Installing SQL Server Express & SSMS
Download both official tools free from Microsoft before following the setup steps below:
Microsoft SQL Server Express
Free database engine edition ideal for beginners, students, and local development.
SQL Server Management Studio (SSMS)
Official Microsoft studio to connect to SQL Server and execute queries.
- Download SQL Server Express from Microsoft's official website.
- Run the installer.
- Choose Basic Installation.
- Accept the license agreement.
- Wait until the installation is completed.
- Download SSMS from Microsoft's official website.
- Run the installer.
- Click Install.
- Wait for the installation to complete.
- Restart the computer if prompted.
- Click the Start Menu.
- Search for SQL Server Management Studio.
- Open the application.
Use the following settings in the connection window:
| Setting | Value |
|---|---|
| Server Type | Database Engine |
| Authentication | Windows Authentication |
You just opened SSMS for the first time. Which Server Type and Authentication mode should you choose to connect locally?
Understanding the SSMS Interface
Once connected, you will work with these seven parts of the SSMS workspace:
1. Object Explorer
Located on the left side. Think of it as the File Explorer of SQL Server. Expand folders to view:
- Databases & Tables
- Views & Stored Procedures
- Security & Programmability
2. Databases Folder
Inside Object Explorer, expand Databases to see:
- System Databases
- User Databases
We will create our own database called StudentDB here.
3. New Query Button
Opens a fresh query tab on the toolbar so you can start typing SQL.
4. Query Editor
The large white workspace area where we type SQL commands.
5. Execute Button
Runs the SQL commands written in the Query Editor (or press F5).
6. Results Window
Appears below the Query Editor and displays the output of SQL queries.
7. Messages Window
Displays execution details, affected row counts, and any error messages.
Keyboard Shortcuts
| Shortcut | Purpose |
|---|---|
| F5 | Execute Query |
| Ctrl + N | New Query Window |
| Ctrl + S | Save Query |
| Ctrl + Z | Undo |
| Ctrl + Y | Redo |
| Ctrl + C | Copy |
| Ctrl + V | Paste |
Common Beginner Mistakes
Cannot Connect
- Ensure SQL Server is installed.
- Verify the Server Name.
- Use Windows Authentication.
No Results
- Remember to click Execute (F5).
Red Underlines
- Check for spelling mistakes.
- Ensure SQL keywords are typed correctly.
1. You wrote a query in the Query Editor, but nothing appeared in the Results Window. Which shortcut runs it?
2. Which panel in SSMS acts like the "File Explorer" of SQL Server?
First SQL Command & Practical Exercise
Follow these quick steps inside SSMS to execute your very first SQL commands:
- Open SQL Server Management Studio and connect to SQL Server.
- Open a New Query window (Ctrl + N).
- Run each of the three commands below using F5.
-- 1. Display text SELECT 'My First SQL Program';
Output: My First SQL Program
-- 2. Display a number SELECT 100;
Output: 100
-- 3. Display current system date and time SELECT GETDATE();
Output: 2026-11-24 10:30:45.123 (current system timestamp)
'My First SQL Program'. Numbers like 100 do not need quotes.
What happens if you run SELECT GETDATE(); in SQL Server, and why are parentheses () required?
() are required because GETDATE() is a built-in SQL function.
Creating Databases, Tables & Data Types
Creating a Database
Create a new database named StudentDB and switch your active context into it:
CREATE DATABASE StudentDB; GO -- Switch context to the newly created database USE StudentDB; GO
USE statement sets the active database for all subsequent queries so your tables are saved inside StudentDB.
Creating a Table
Now create a Students table with four columns and a Primary Key:
CREATE TABLE Students ( StudentID INT PRIMARY KEY, Name VARCHAR(100), Age INT, Course VARCHAR(50) );
Common Data Types Reference
| Data Type | Used For | Example |
|---|---|---|
INT | Whole numbers | 1, 25, 1000 |
BIGINT | Very large whole numbers | 9999999999 |
DECIMAL(p,s) | Exact decimal values | 1234.50 |
FLOAT | Approximate decimal values | 98.75 |
BIT | Boolean values | 0 (False), 1 (True) |
CHAR(n) | Fixed-length text | Gender = 'M' |
VARCHAR(n) | Variable-length text | Name = 'Rahul' |
NVARCHAR(n) | Unicode text (Telugu, Hindi, etc.) | 'à°ªూà°°్ణప్à°°à°¸ాà°¦్' |
DATE | Date only | 2026-11-24 |
TIME | Time only | 10:30:45 |
DATETIME | Date and time | 2026-11-24 10:30:45 |
MONEY | Currency values | 25000.75 |
1. You want to store student names in Telugu (like 'à°ªూà°°్ణప్à°°à°¸ాà°¦్') or Hindi. Which data type should you pick?
2. Which data type stores Boolean values (0 for False, 1 for True)?
Inserting, Querying, Updating & Deleting Data
Inserting Data
INSERT INTO Students VALUES (1, 'Rahul', 20, 'Python'); INSERT INTO Students VALUES (2, 'Anjali', 21, 'SQL'); INSERT INTO Students VALUES (3, 'Kiran', 22, 'Java');
Querying Data
-- Fetch all columns SELECT * FROM Students; -- Fetch only Name and Course SELECT Name, Course FROM Students;
Updating Data
UPDATE Students SET Age = 23 WHERE StudentID = 3;
Deleting Data
DELETE FROM Students WHERE StudentID = 2;
WHERE clause when updating or deleting to prevent modifying or erasing every row in the table unintentionally.
1. What happens if you run UPDATE Students SET Age = 25; without a WHERE clause?
2. Which query shows only the Name and Course of all students?
Viewing Table Metadata & Dropping a Table
Viewing Table Metadata with sp_help
Run sp_help to inspect a table's columns, data types, indexes, and constraints:
sp_help Students;
Dropping a Table
DROP TABLE Students;
The DROP TABLE statement permanently removes the table and all its data from the database.
Commands Covered Today
You want to check the data types of your Students table, remove Kiran's row, and keep the empty table for future students. Should you use DELETE or DROP TABLE, and how do you inspect the table structure first?
1. Run
sp_help Students; to inspect the columns, data types, indexes, and constraints.2. Use
DELETE FROM Students WHERE StudentID = 3; to remove only Kiran's row while keeping the table intact.3. Do not use
DROP TABLE Students; because that permanently destroys the entire table structure along with every row.
0 Comments