From the course: Complete Your First Project in SQL

Codespaces

- [Instructor] In this video, I will show you how to use codespaces for this course. GitHub Codespaces is a development environment that's hosted in the cloud. You can access codespaces in the course GitHub repo. Let's take a moment to look at the GitHub repo you will be using for this course. When you look at the GitHub repo, you'll notice there are three different chapter folders containing the different coding files. If you click on the chapter one, you'll see the different coding files used for the different videos in this course. The way these files are denoted is, for example, you'll see 0103, and that will be for the third video in chapter one. You'll also notice that there is usually a B, or an E at the end of most of these coding files. The B file is the one I suggest you start with, and this will be the file you type your code in to follow along with the course video. The E file can be used for reference if you are stuck on your code to check and make sure that your code is matched to that one, and that it's running appropriately. You'll notice that some of the coding files have check at the end of them. This is just a set of code that is already ready to go for you to use to do a quick check on something that you ran in the code. There are also three coding files that will have challenge, and then also solution for each of these chapters for the different challenges you'll be completing. So again, the challenge file is the one you'll start with, and the solution file is the one that you will end with. So, like the other files, the challenge file is the one you will type your code in, and the solution file is the one you will use for reference. Let's navigate back out here. If you scroll down, you can also look at the readme for this particular GitHub repo. Again, I should explain the file structure of those different coding files throughout. There are a few different ways you could download files directly from the GitHub repo. Let's say you wanted to download the readme file. You could go over to the right here and select download raw file. Click that, and it should download to your computer. Another way you could do this if you don't want to download each file individually is you could go over to this coding button, select the local tab, and select download Zip. That should download all the files in the GitHub repo to a zip folder on your computer. Just make sure that you unzip it first to then access the files and place them wherever you wish on your computer. Next, we will explore how to navigate to codespaces in your GitHub repo. So going back to this coding tab, you'll make sure you're selected on the codespaces. Here at the top, you'll have the option to create a codespace on main, or you can select one of the codespaces you already have active. So, I already have Zany Garbanzo, so I can select that to open that current codespace that I'm using. To navigate to the codespace this way and create a new codespace on main, you click this plus button, and it should open a new tab up to set up your codespace. Note that the first time you do this, it may take a few minutes to build and then load your codespace. After that, once you navigate to a codespace that you already have built, it shouldn't take nearly as long to load. Another option to navigate to codespace is by using the link below this video of the course to get to this same spot. Once your codespace loads, it should look something like this, where it has the readme file here, it has the terminal, and off to the left is the navigation bar, where you can use to navigate to the different coding files and the database. I highly recommend you use the same codespace throughout the course. That way, it saves the work for each of the different coding files you are editing. This is because work you do in a codespace does not transfer to other codespaces you may have. Let's begin by navigating the left side menu. So, you'll notice here is the explorer option, so that should show all the different files in the GitHub. So, you could click on chapter one, and it should show all the different files that you have here. So, if you click on the 0102 check SQL file, this should show the SQL file for you to use. If you click on it once, it'll show up, but if you navigate to other files, it'll simply replace where that one is with these different files you're opening. If you want to open this file and keep it there, you simply click on it twice. And so now, if you open other files again, you can easily navigate back to this one. Since this course is going to be running on a SQL database, you will be running these different coding files on your active database connection. So, the way to do that is you'll click run on active connection. And the first time you do this, each time you go into your codespace or reload it, you will be selecting this H plus support option here, and then it should show the results over here. If you wish to push this down, since it is kind of in the way, you simply click it here and drag this down. or you can even select the X over here to completely get rid of that terminal. If you wish to have the terminal show back up, simply click on console, and it'll show up again. As you can see here, after you have run this on the database connection, you'll still see your code off here to the left. But then, off to the right, you will see the output for that particular code. So, this will be fairly typical for us throughout the course to see where, again, you'll have the code on the left side and then your output on the right-hand side. And you can use the scroll bar here to navigate along the output you are seeing. And again, if you run this multiple times, then you'll just see multiple outputs. And again, you can click on these to navigate to the different outputs you see. If you wish to see the database directly, you can simply go down here to the cylinder where it says SQL tools. And then you can navigate amongst the database. I will show in a later video how to navigate through this database more thoroughly, but in the meantime, this is how you can access it. Once you are done with your coding session, there are a few different ways you could close the codespace. One easy way is going down to the bottom left here, selecting this, and select stop current codespace. What this will do is it'll stop the current codespace while saving all the edits that you made throughout your session. Once your codespace has stopped, it should show something like this where it says codespace has stopped, and it gives you the option to restart the codespace here. So, you could click this, and then it will bring you back into your codingspace, and it should show like it did when you recently left off. So again, it'll even show the different files that you had open and all of that. Like I said, this codespace now that it is created should take a lot less time to load than the first time around that it was created. Now that it's loaded, you could see it has us in the connection portion of the SQL database. It has your file up. The main thing I won't have up is the different outputs since that is cleared each time you go out of your codespace. If you go to your GitHub repo and look at the code section after you refresh your browser, you should be able to now see your new codespace. Mine is called Scaling Happiness. That is ready to go, and it's currently active because it is currently open. And again, this is one of the ways you can navigate to it. in between your different coding sessions. Now that you know how to use GitHub Codespaces, you are ready to follow along with me as we code some SQL.

Contents