Data Training Courses

Home | Power BI | Excel | Python | SQL | Generative AI | Visualising Data | Analysing Data

GitHub Codespaces

This method is to be used as a last resort, if you are blocked from access to the VMs by your trust IT policy and there is no way round this. It is not guaranteed to work since some trusts block the GitHub website. There is considerably more work to set this approach compared to the VM approach.

This uses GitHub Codespaces to bring up a SQL editing session in a browser, and within that session install the SQL Server mssql extension to connect to the database. This will bring up a web version of VSCode, a popular editor.

Here are steps by step instructions. Note that the user interface may be slightly different to these images below.

In a browser, go to the GitHub website. Sign in if you already have an account, or create a free GitHub account if not.

Click on the “Create new repo” or similar button to see the form below.

github image
Enter a repo name, such as my-sql-course, and ensure this is a public repo. Click on the “Create a new repository button”.

github image
Click on the “creating a new file” link.

github image
Choose a name for the file, such as “first.txt” and enter a line of text then click on the gree “Commit Changes” button.

github image
Click on the “Commit Changes” button.

github image
Congratulations - you have created a new repo and added your first file. Click on the green “Code” button.

github image
Click on the “Codespaces” tab.

github image
Click on the green “Create codespace on main” button.

github image
You are now in a web editor running a popular editor, VSCode. Choose a theme and click on the “<” chevron in the top left to go to the Welcome screen

github image
In the Welcome screen, click on the Extensions icon in the Activity bar (the vertical set of icon on the left). Search for mssql, then install the SQL Server (mssql) extension.

github image
Create a new file, and name it with a .sql file type, e.g. test1.sql. A notification at the bottom right of the screen will ask if you want to enable modern development features. Click on the blue “Enable Experiences & Reload” button.

github image
There will now be a new SQL Server icon in the Activity list. Click on this, then click on “Add Connection”. This will bring up a “Connect to SQL Server” form. Enter the connection details provided by the trainer.

github image
You can expand the explorer bar below the connection to view the tables.

github image
Create a new query from the newly created connection - this will open a tab where you can enter a SQL statement.

github image
Enter a simple, SQL statement, press the Play button to execute it, and view the results in the pane below.

github image
Congratulations, you have finished the set up process!

Forking the SQL Course Repo

You may want to fork (make a copy) of teh course repo so you can inspect the example SQL statements used in the courses. If so follow these steps below.

Once signed in go to the repo for this SQL course here.

Click on the “Fork” button to fork this repo. This will then copy the repo to your account (and will note ‘Forked from MarkWilcock/sql-course’).

On the page for the forked repo, click the green “Code” button, use the “Codespaces” tab from the flyout then click on “Create Codespace on main”. GitHub currently provides about 60 hours per month for free.