Introduction
Most modern software applications must store data permanently, such as users, products, orders, payments, or reports. Keeping this information only in ordinary files can quickly become inadequate when an application needs reliable searching, updates, security, concurrent access, and data consistency. Relational database management systems were designed to organize data and provide dependable access to it.
This lesson is the starting point for the Microsoft SQL Server learning path. We will first identify the fundamental building blocks of a relational database. We will then distinguish between SQL Server, the Database Engine, and SQL Server Management Studio (SSMS). By the end of the lesson, you will be able to connect to a local SQL Server instance with SSMS, create a simple database and table, and execute a basic query.
What is a relational database?
A relational database organizes information in tables that can be related to one another. Each table focuses on a particular subject. For example, a sales application might store customers, products, and orders in separate tables. This approach divides information into meaningful structures instead of placing unrelated data into one large and difficult-to-maintain table.
The main purpose of the relational model is to store data in an organized and consistent way. Connections between tables are established through keys. For example, an order can refer to a unique value in the customer table to indicate which customer placed that order.
Fundamental concepts
| Concept | Description | Example |
|---|---|---|
| Database | A logical structure containing related tables, views, procedures, and other objects. | SalesDb |
| Table | An object that stores data about a specific subject in rows and columns. | Customers |
| Record or row | A set of values representing one entity or event in a table. | One customer |
| Field or column | A structure that describes one property of a record. | EmailAddress |
| Schema | A container or namespace used to organize and name database objects. | dbo |
| Key | A column or group of columns used to identify records uniquely or establish relationships. | CustomerId |
A table may look similar to a spreadsheet, but a database table is more than a visual list. Columns have data types, nullability rules, keys, and constraints. These rules help prevent applications from storing invalid or meaningless data.
The relationship between tables, records, and fields
Consider a table that stores customers. In a Customers table, each row represents one customer and each column represents one customer attribute:
CustomerId | FullName | EmailAddress
1 | Ayse Demir | ayse@example.com
2 | Mehmet Kaya | mehmet@example.comHere, CustomerId distinguishes one customer from another. FullName and EmailAddress describe properties of the customer. The first row belongs to Ayse Demir, while the second row belongs to Mehmet Kaya.
In a well-designed table, each column should have one clear meaning. Storing a person's first and last name in one text value may seem convenient, but it can make some searches and reporting tasks more difficult. On the other hand, splitting every small piece of information into separate columns can make a design unnecessarily complex. Throughout this course, we will consider requirements, readability, and data integrity together when designing tables.
The schema concept
In SQL Server, a schema is used to group database objects logically. Tables, views, stored procedures, and functions can belong to a particular schema. The fully qualified name of an object is commonly written as SchemaName.ObjectName. For example, in dbo.Customers, dbo is the schema and Customers is the table name.
A schema and a database are not the same thing. A database is the broader container; a schema is a namespace inside that database used to organize objects. In larger projects, multiple schemas can separate application areas, simplify object naming, and support more controlled permissions. At the introductory level, many examples will use the default dbo schema.
Core components of the SQL Server ecosystem
SQL Server
SQL Server is Microsoft's database platform for storing, querying, protecting, and managing data. Versions such as SQL Server 2019 and SQL Server 2022 may differ in features and support policies, but the fundamental database and T-SQL concepts covered in this course are largely consistent between them.
Database Engine
The Database Engine is the core service that processes data in SQL Server. It manages database files, executes queries, applies transactions, enforces security checks, and provides data access. When a user or application sends a query, the Database Engine is the component that receives and executes it.
A SQL Server instance
A computer can run one or more Database Engine instances. An instance is a running SQL Server service that manages its own databases and configuration. When connecting to a default instance, the computer name may be sufficient. For a named instance, the connection name commonly follows the pattern COMPUTERNAME\INSTANCENAME. SQL Server Express installations often use an instance name such as SQLEXPRESS.
SQL Server Management Studio
SSMS is a graphical management environment used to connect to SQL Server and related database services, manage objects, and execute T-SQL queries. SSMS is not the Database Engine itself. It is a client tool that connects to the Database Engine. In other words, SSMS is where you write and submit commands, while the Database Engine stores data and executes those commands.
| Component | Primary role | Simple analogy |
|---|---|---|
| SQL Server | The database platform and collection of services | A working environment |
| Database Engine | Stores data, processes it, and executes queries | The engine doing the work |
| SSMS | Connection, administration, and query-writing interface | The control panel used to operate the engine |
Connecting with SSMS
The following steps assume that SQL Server 2019 or 2022 Database Engine is installed on a local Windows computer. SSMS must also be installed.
- Open SQL Server Management Studio from the Start menu.
- In the Connect to Server window, leave Server type set to Database Engine.
- In Server name, enter the server or instance name appropriate for your installation. For a local default instance, use the computer name. For SQL Server Express, you may use a value such as
localhost\SQLEXPRESS. - In Authentication, select the method configured during installation. Windows Authentication uses your Windows account; SQL Server Authentication requires a SQL Server login and password.
- Select Connect. If the connection succeeds, Object Explorer displays the server and its database-related nodes.
If the connection fails, first verify that the Database Engine service is running, that the server name is correct, and that the selected authentication method matches the installation. Connections to remote servers may also require network protocols, port configuration, and firewall rules. These topics will be covered in more detail later.
First application: a simple database and table
In SSMS, select New Query to open a query window. The following script creates a basic structure that will be used during this lesson:
CREATE DATABASE TrainingDb;
GO
USE TrainingDb;
GO
CREATE TABLE dbo.Customers
(
CustomerId INT NOT NULL,
FullName NVARCHAR(100) NOT NULL,
EmailAddress NVARCHAR(200) NULL
);
GO
SELECT DB_NAME() AS CurrentDatabase;
SELECT name FROM sys.tables;CREATE DATABASE creates a new database. GO is a batch separator recognized by SSMS; it is not a T-SQL statement processed by the Database Engine. USE changes the active database for subsequent commands. CREATE TABLE creates a table named Customers under the dbo schema.
This example does not yet define a primary key. The purpose is to demonstrate the structure and roles of the main components in a simple way. In a later lesson, we will configure CustomerId as a primary key and examine how keys contribute to data integrity.
Common mistakes
- Confusing SSMS with the Database Engine: Closing SSMS normally does not delete the database; SSMS is a management client.
- Using the wrong server name: A default instance and a named instance use different connection names.
- Running a query in the wrong database: Check the database selector at the top of the query window or use the
USEstatement. - Ignoring the schema name: Writing
dbo.Customersexplicitly identifies the object and reduces ambiguity. - Storing everything in one table: Combining customers, products, and orders in one table can create duplicate data and update problems.
- Choosing data types carelessly: Use suitable numeric types for numbers and choose between
VARCHARand Unicode-capableNVARCHARaccording to the data requirements.
Short practice exercise
Complete the following activity in SSMS:
- Connect to
TrainingDb, or executeUSE TrainingDb;in a query window. - Create a table named
dbo.Courseswith the columnsCourseId INT,CourseName NVARCHAR(150), andDurationHours INT. - List the tables in the database by querying
sys.tables. - Display the name of the active database by using
DB_NAME().
As you work, answer these questions: Which component executes the query? What does dbo represent? What is the difference between a row and a column in a table?
Conclusion
In this lesson, you learned the basic logic of relational databases and how data is organized through tables, rows, and columns. You also distinguished a database from a schema and saw that keys are used to identify and connect data.
You also learned that SQL Server is an ecosystem containing components such as the Database Engine and SSMS. The Database Engine is the core service that stores data and executes queries, while SSMS is the tool used to connect to and manage that service. In the next lesson, we will examine SQL Server installation options, instance configuration, and the SSMS working environment in greater detail.
Sources
- https://learn.microsoft.com/en-us/sql/database-engine/sql-database-engine?view=sql-server-ver17
- https://learn.microsoft.com/en-us/ssms/sql-server-management-studio-ssms
- https://learn.microsoft.com/en-us/sql/relational-databases/tables/tables?view=sql-server-ver17
- https://learn.microsoft.com/en-us/sql/relational-databases/system-catalog-views/schemas-catalog-views-sys-schemas?view=sql-server-ver17
- https://learn.microsoft.com/en-us/sql/sql-server/connect-to-database-engine?view=sql-server-ver17