Unit 07 · Practice
Practice
There are two databases on this page: the HR database and the college database from the lessons. Each question has its database's diagram right above it, one question at a time. In the college database, the classes and instructors are real as of October 2026, and the students, enrollments, and GPAs are made up.
Type your query in the box and click Run, or press Ctrl + Enter (Cmd + Enter on a Mac). Run as many queries as you want on the way to the answer. When the answer is a count of rows, don't count them by hand. The total is shown under the results table.
Part 1 is nine questions about reading the diagrams. You answer them from the diagrams, without writing any queries.
Part 2 is six questions where you write queries from the diagrams. Each one is checked.
Everything you run and answer on this page is recorded and goes into your submission.
Questions 1 to 5 are about the HR diagram, just below. Answer them from the diagram. You don't need to run any queries.
According to the HR diagram, what are the columns of the countries table?
Which column is the primary key of the countries table? Type the column's name.
What is the relationship between regions and countries?
The line from employees back to itself connects manager_id to employee_id. Which of these reads it correctly?
One of the columns in the locations table is a foreign key. Which one? Type the column's name.
Questions 6 to 9 are about the College Courses diagram, just below.
According to the College Courses diagram, which of these columns can be NULL?
Suppose you're adding a column for each instructor's office, and the database should require one for every instructor. Offices are named by building and room, like SC 210. What should the new line in the instructor box say?
Suppose you're adding a last_accessed column to the enrollment table. It's the last time the student opened that class in Canvas. Which type should it be, and should it be allowed to be NULL?
A column is decimal(5,2). What's the biggest value it can hold?
Write each query from the diagram. Questions 10 to 12 run against the college database, and questions 13 to 15 run against the HR database. Each question's box runs against the right one.
LIKE '%Software%' matches "Software" anywhere in the title.
In the college database, how many different students have at least one enrollment with no GPA yet?
A student can have several enrollments with no GPA. Count each student once.
The job title is in jobs and the department's name is in departments. Both have a line to employees, so join each of them to employees.
The country's name is in countries. Follow the lines from departments to locations to countries.
In the HR database, what is the job title of the highest-paid employee who works in the Europe region? Type the job title.
The path from employees to regions goes through departments, locations, and countries. The job title is in jobs. Add one join at a time and run the query after each.
When you're done, download your submission file and upload it to this unit's practice assignment in Canvas. It carries a summary of your progress and the record of every attempt you made on this page. You can submit as many times as you like; the last one counts.
Attempts are saved in this browser. To keep going on another computer, download your submission here and resume from it there.