| Field | Detail |
|---|---|
| Repository | sql-server-lab |
| Primary language | Mixed / documentation |
| Topics | database, database-labs, devarent, docker, lab, relational-database, sql-server, t-sql |
| License | MIT |
| Branch | main |
| Maintainer | @devarent |
sql-server-lab is a hands-on repository focused on: Run SQL Server 2022 Developer Edition in Docker and practice T-SQL with sqlcmd.. Primary language: Mixed / documentation. Topics: database, database-labs, devarent, docker, lab, relational-database, sql-server, t-sql. The README below documents the project; use the table above for a quick overview.
🇮🇸 Iceland · 🇳🇿 New Zealand · 🇨🇭 Switzerland · 🇸🇮 Slovenia · 🇮🇪 Ireland · 🇦🇹 Austria · 🇵🇹 Portugal · 🇸🇬 Singapore · 🇫🇮 Finland
Run SQL Server 2022 Developer Edition in Docker and practice T-SQL with sqlcmd.
SQL Server is common in enterprise .NET estates and data platforms. This lab runs the Developer edition locally, gives you a LabDB database, and walks through T-SQL features that differ from PostgreSQL and MySQL: batches, TOP, OFFSET/FETCH, and MERGE.
docker compose up -d
docker compose cp examples/01_schema.sql sqlserver:/tmp/01_schema.sql
docker compose exec sqlserver /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'Str0ng!Passw0rd' -C -i /tmp/01_schema.sql
docker compose exec sqlserver /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'Str0ng!Passw0rd' -C -Q 'SELECT name FROM sys.databases'| Field | Value |
|---|---|
| Host | localhost |
| Port | 1433 |
| Database | LabDB |
| User | sa |
| Password | Str0ng!Passw0rd |
| JDBC URL | jdbc:sqlserver://localhost:1433;databaseName=LabDB;encrypt=true;trustServerCertificate=true |
| sqlcmd | sqlcmd -S localhost -U sa -P 'Str0ng!Passw0rd' -C |
| File | What it shows |
|---|---|
docker-compose.yml |
Engine, ports, and persistent volume. |
.github/workflows/compose-check.yml |
Validates the Compose file on every push. |
examples/01_schema.sql |
Creates LabDB and a small sales schema. GO separates sqlcmd batches. |
examples/02_queries.sql |
Seed data, TOP, a window function, and MERGE. |
- Add a
productstable and anorder_itemstable, then compute totals withGROUPING SETS. - Compare the execution plan of the revenue query with and without the index.
- Create a stored procedure that returns the top N customers by revenue.
- Try
SELECT * FROM dbo.orders FOR JSON PATHand inspect the JSON output.
- Developer Edition is free for non-production development and testing.
- The SA password must meet SQL Server complexity rules. Change it before exposing port 1433.
- Recent 2022 images ship sqlcmd at
/opt/mssql-tools18/bin/sqlcmd; older images use/opt/mssql-tools/bin/sqlcmd. - This image is published for linux/amd64. Apple Silicon users need emulation.
This lab publishes its ports on 127.0.0.1 only. To use it from another country, do not open the database port to the internet. Pick one:
- VPS + private tunnel: run the lab on a small Ubuntu VPS, keep the port closed, and connect through WireGuard or
ssh -L. - Managed service: use a managed free tier for this engine and point the same examples at its connection string.
- HTTP UI only: if the engine has a web UI, put it behind Caddy with TLS and basic auth.
The shared checklist, provider map, and commands are in REMOTE-ACCESS.md.
docker compose down -v-v also removes the named volume, so the next start is a clean slate.
Part of the database-labs collection: 26 database engines, one index.
MIT (c) 2026 Arya Fatthurahman. See LICENSE.
Full Tech Stack Wall
Connection names shown in the DBX sidebar - decorative reference badges.