Practice Problems - Write 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:

https://i.ibb.co/r6qShy5/practice-grade.png

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.

note: When you run the code, there will be several execution results. Please only refer to the unittest and the last execution result for debugging purposes.

In the grades table:

https://i.ibb.co/r6qShy5/practice-grade.png

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 for final test_name to 90.

note: When you run the code, there will be several execution results. Please only refer to the unittest and the last execution result for debugging purposes.

In the grades table:

https://i.ibb.co/r6qShy5/practice-grade.png

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.

note: When you run the code, there will be several execution results. Please only refer to the unittest and the last execution result for debugging purposes.

Aside from the grades table:

https://i.ibb.co/r6qShy5/practice-grade.png

We also have a students table:

https://i.ibb.co/m4KxSMC/practice-students.png

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.

note: When you run the code, there will be several execution results. Please only refer to the unittest and the last execution result for debugging purposes.

Aside from the grades table:

https://i.ibb.co/r6qShy5/practice-grade.png

We also have a tests table:

https://i.ibb.co/KVTGNXh/practice-tests.png

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.

note: When you run the code, there will be several execution results. Please only refer to the unittest and the last execution result for debugging purposes.

What to do next

Click on the following link to go to the post test: Post Test

You have attempted of activities on this page