1. 学习
  2. /
  3. 课程
  4. /
  5. Querying a PostgreSQL Database in Java

Connected

练习

Sorting the data

CityBook Libraries' search feature works well, but users want to sort results by publication year in either ascending or descending order. You'll build the query dynamically to handle both sort directions.

The HikariSetup class is already configured for you.

说明

100 XP
  • Complete the query to sort the result by the publication_year.
  • Extend the query to sort in ascending or descending order depending on the ascending variable representing the user input.