Setting Up SQL Server and SSMS
To practise T-SQL, you need a SQL Server instance to connect to and a tool to write and run queries against it — SQL Server Management Studio (SSMS) is the standard choice.
Installing SQL Server
SQL Server Express is a free edition suitable for learning and small applications, with generous limits for practice purposes. It can be installed on Windows directly, or run in a Docker container on macOS and Linux.
Connecting With SSMS
SQL Server Management Studio is a free graphical tool for connecting to a SQL Server instance, browsing databases, and writing queries in a dedicated query editor with syntax highlighting and execution shortcuts (typically F5 to run a query).
CREATE DATABASE SchoolDB;
GO
USE SchoolDB;
GO
Common Mistakes
- Forgetting to run
USE DatabaseName;before working with tables, accidentally operating on the wrong database. - Not saving connection details, requiring the server name and credentials to be re-entered every session.
- Confusing the GO batch separator (an SSMS/tool-level command) with a T-SQL statement itself — GO is not part of the T-SQL language.
- Installing a full SQL Server edition when the free Express edition would be more than sufficient for learning.
Professional Tip
In SSMS, GO is a batch separator recognised by the tool, not a T-SQL keyword. It tells SSMS to send everything above it to the server as one batch before continuing — useful when a statement like CREATE DATABASE must run in its own batch.
Your Turn
Install SQL Server Express and SSMS, connect to your local instance, and create a new database called PracticeDB.
Mini Quiz
What must you typically run before working with tables in a specific database?
USE statement switches the current session's context to a specific database, so subsequent queries run against the correct set of tables.