When you work with databases all day every day it’s easy to forget that many people new to the technology development space will not have used a relational database. Once I get over the moment of surprise, I think about the question if I wanted to learn now, where would I start?
There are plenty of websites that can teach you the basics of the SQL language. I’ll list a couple sites below that are reasonable:
The SQL language has a common core syntax but each database vendor has their own variations. If someone was starting today I would recommend you start with one of the following:
- MySQL if you want to focus on an open source/Linux environment.
- Microsoft SQL Server for a commercial DB product.
I would recommend MS SQL Server if you did not have a personal preference.
The next step in this learning process is that after the theory comes the practical. For the practical part having your own database is the easiest option. There are many options that you can try:
- Virtual DB on the web. My go to site in this regard is http://sqlfiddle.com/
- Cloud based RDBMS offerings from AWS or Azure
- Install your own copy. Microsoft and MySQL both have free to use software you can install on your own machine.
Like all technical tinkerers, having my own local DB is the most appealing option and this is what the remainder if this blog is dedicated to achieving. What comes next is a guide in getting started with MS SQL Server.
Prerequisite for this guide is a computer running the Windows Operating System and a reasonable internet connection as there is a lot to download.
There are 3 pieces of components that are needed.
- The database, specifically SQL Server 2017 Express edition. Use the below link to download the software.
- The front end. SQL Server Management Studio (SSMS) is the tool you should get used to using. Use the below link to download the software.
- Some sample data to run your SQL queries against. The default sample database for Microsoft is the AdventureWorks database which you can download using this link
Run the SQLServer2017-SSEI-Expr.exe that was downloaded and select the Basic option for the install
Accept the license terms
Accept the default location and select Install
The front end
Run the SSMS-Setup-ENU.exe that was downloaded and select Install
Some sample data
From the Start Menu run Microsoft SQL Server Management Studio 17. This should default to the connection database instance you have just installed so just select connect.
Right click on the database folder and select the Restore Database… option
Select the Device radio option then click on the …
Click the Add option and navigate to the file location where you downloaded the AdventureWorks2016.bak file and click OK
If you now expand the Databases you should now see the AdventureWorks2016 database and you are ready to go.
Right click on the AdventureWorks2016 database and select New Query and start typing your SQL