In these modules, we'll review a series of ten challenging practice questions that will prepare you for your SQL interview.
Once you complete these exercises, you'll have a solid grasp on the types of database challenges that are likely to come your way if you interview for a technical role at a high-powered company.
We'll be using MySQL throughout these challenges, as it's the most commonly-used version of SQL today. However, most of the model answers contained in these modules are applicable to other versions of SQL like Postgres — oftentimes with minor symantic modifications.
Using our sample dataset
Before getting started, it's highly recommended that you set your computer up to run queries on our live sample database.
To do so, follow these instructions:
- Install MySQL. You can download it from the official MySQL website (you can also find their installation instructions here).
- Download the database. This database contains all of the data that you'll be using in these exercises, and downloading it will allow you to test your queries live. You can download it one of two ways:
- Download deskbright_cocoa.sql directly at this link and move it to a directory of your choosing; or
- Open Terminal and run the following command:
- Start your MySQL server. If you're on a Mac, you can usually do this by going to
System Preferencesand navigating to the
- Run MySQL. You can do this by typing the following in your terminal:
$ mysql -u root
- Run the deskbright_cocoa.sql file you downloaded. After opening MySQL, a
mysqlcommand prompt will appear. In this prompt, we'll run a command to install the Deskbright database. This will create a new database called deskbright_cocoa and insert all necessary data. To do all of this, type the following in your terminal:
mysql> SOURCE deskbright_cocoa.sql;
$ curl -O https://s3.amazonaws.com/deskbright/data/deskbright_cocoa.sql
To access the database after installation, all you have to do is start your MySQL server, then run MySQL:
$ mysql -u root
And tell MySQL that you want to use the
mysql> USE deskbright_cocoa;
How to navigate your new course
This course is divided into Sections, each of which contains multiple Lessons. At the bottom of each lesson, you'll notice a button that looks like this:
Press this button to mark the lesson as finished and move on to the next lesson!
If you change your mind, you can un-complete a lesson using the dropdown on the upper-right portion of your screen:
On the left side of your screen, you'll see a table of contents that looks something like this:
Mouse over the elements in the table of contents above to see what they mean.
Ready to get started? Great! Go ahead and hit the 'complete lesson' button at the bottom of the page to move on.