From the course: Practice It: Advanced SQL
Using GitHub Codespaces with this course - SQL Tutorial
From the course: Practice It: Advanced SQL
Using GitHub Codespaces with this course
- [Instructor] So now, I'm going to show you how to use GitHub Codespaces to perform the challenges for this course. Codespaces is a code editor in the cloud with the full power of Visual Studio Code. This allows you to gain hands-on practice that mirrors real-world data analysis in the workplace. Using Codespaces allows you to also get started without any complex installations. Codespaces utilizes SQLite, so all functions and operators presented in this course will also be from the SQLite library. To practice along with the course, you can create a codespace directly from the course overview page. First, click Open next to GitHub Codespaces. If you're already logged in, you'll be directed to a Getting Started with GitHub Codespaces page. If you're not logged in, you'll be prompted to log in or create a free GitHub account first. From this page, click on create codespace on the main. Once it's done, you'll enter the code environment. The first time you open a codespace, it might take a few minutes to create the virtual machine. Codespaces saves everything you're doing on a virtual machine, so if you inadvertently close your browser, there's no need to panic, you can always restart your codespace at a later time. Now, let's go over our codespace setup. If you see this popup on the bottom right hand corner that says do you want to install the recommended SQLite Viewer extension, click Install. Then, click Explore on the left hand side to get back to our setup. On the left hand side, you'll find the four folders labeled with the name of each of the course modules. Each folder will contain a file with the code solutions for the challenges called Answers, a file with the challenge questions, a setup_script where you'll run your code, and a database file containing the database for that module. The database file will be labeled with the naming convention of the module title_data. To execute the code, you'll open up the setup_script file. Once open, right click on the tab, then left click on Split Down. There will be code already there on the setup_script file. This is the code that will create the database. To initialize the database for your challenges, highlight the code, right click, then left click Run Selected Query. On top, there will be a dropdown to choose a database. Each module will have their own separate database. Choose one that is labeled with the module name that you are currently using. In this case, we're currently working with the Window-Functions folder, and we'll choose the third option down called Window-function/window_function_data.db. Notice that each will be labeled as folder name/database name. Once you choose your database, notice a SQLite tab shown on the bottom of your screen. This tab will show the results of your queries. To execute the queries for your challenges in the setup_script file, you will just write your code below. Then highlight it. Right click, then Run Selected Query. Your results will be shown below. If you decide to keep the code for multiple queries in the same tab, be sure to end each query with a semicolon.