47 The quiz application: Part 1

 

In this capstone, you will

  • Read and write the quiz data from a PostgreSQL database asynchronously
  • Define SQL queries to create, retrieve, update, and delete records
  • Chain multiple asynchronous computations to safely store a question and its answers

In this capstone, you’ll define an application’s data access layer to create and answer quizzes. You’ll implement its business logic and HTTP API at the end of the next unit. Your quiz application has the following requirements:

  • It should read and write categories and a set of questions and answers assigned to them.
  • Its users should pick a category, answer randomly selected questions about it, and receive a final score based on their performance.

Your application has access to a PostgreSQL database containing three tables called category, question, and answers. Figure 47.1 shows their table structure.

Figure 47.1 Visualization of your database schema. Primary keys are in bold, while foreign keys are linked to their reference. The entity-relationship diagram has been drawn using dbdiagram.io.

47.1 Download the base project

47.2 Health check queries

47.3 Category queries

47.4 Question and answer queries

47.5 Let’s give it a try!

Summary