Database foundations
SQL, SQL Server and SSMS
Distinguish the language, engine and client.
Understand the concept
SQL describes the result you want from relational data. Usually you specify the desired result set rather than the order of individual loops. This is a declarative approach: the same logical query can run through different physical plans.
SQL Server is Microsoft’s database engine. T-SQL is its SQL dialect, with variables, procedures and error handling beyond the common SQL core. SSMS is a client used to connect, write queries and administer the engine. Installing SSMS alone does not mean a SQL Server instance is running.
Separate commands by purpose: SELECT reads data; INSERT, UPDATE and DELETE change rows; CREATE and ALTER change object definitions; COMMIT and ROLLBACK control transactions; GRANT and REVOKE manage access. These categories are useful mental models, not a claim that every vendor classifies every statement identically.
Use this distinction to locate connection, syntax and environment problems.
GO is a client batch separator, not a T-SQL statement. Do not send GO inside an application query.
One topic. Three levels of depth.
SELECT @@VERSION AS EngineVersion;Returns the engine version, not the client version.
This page does not execute SQL. Practise in the downloadable SqlStudioLab using SSMS. Before rerunning temporary-table examples, remove only the relevant #table. Views, procedures and functions create persistent lab objects; never use a production connection.
Try it yourself first.
Show the database and server name in one query.
Show the solution and explanation
SELECT DB_NAME() AS DatabaseName, @@SERVERNAME AS ServerName;SQL Server Express, LocalDB and a remote server may require different instance connections.