Practice Problems - Mixed-up Code¶
Now, let’s spend 15 minutes to practice what we just learned!
Please do not refer back to the previous page or outside resources.
You can stop working on a problem after you worked on it for about three minutes without solving it.
Problems¶
In the grades
table:
Please write a SELECT statement to retrieve the student_id
, test_name
,
and english
of all entries whose english
is lower than 60 and math
is higher than 90.
In the grades
table:
A student completed an extra assignment and got some additional points.
Please write an UPDATE statement to change the entry whose student_id
is 1, and set their math
score to 90 in the final
test (test_name
column).
In the grades
table:
The instructors decided to add some points to all students as one test was too difficult.
Please write an UPDATE statement to change all entries whose test_name
is midterm
,
and add 10 points to their english
score.
Aside from the grades
table:
We also have a students
table:
Now we want to match the student name to their math grades.
Please write a statement using SELECT and JOIN to: select the test_name
and math
from the grades
table and name
from the students
table, where the student_id
in the grades
table is the same as the id
in the students
table.
Aside from the grades
table:
We also have a tests
table:
Now we want to add the date information to the grades to see when the students took the tests.
Please write a statement using SELECT and JOIN to: select the date
and name
from the tests
table and student_id
from the grades
table,
where the test_name
in the grades
table is the same as the name
in the tests
table.
What to do next¶
Click on the following link to go to the post test: Post Test