Exercise 2 of 17

Retrieve Basel sequences

Fixed training server

Retrieve the 20 most recent sequences from Basel-Stadt, Switzerland, showing the GenBank accession, date, unaligned nucleotide sequence, aligned nucleotide sequence and S amino acid sequence.

The output should have this shape:

genbankAccession | date       | unaligned_main | main    | S
---------------- | ---------- | -------------- | ------- | ------
AB123456         | 2024-05-10 | ACGT...        | ACGT... | MFV...

Write a query and run it. The result is compared with the reference answer without considering row order.

Loading query editor…
Explanation

Filter the table to sequences from Switzerland and Basel-Stadt. Order the rows by date descending, project the requested columns and keep the first 20.

Reference answer
default
  .filter(country = 'Switzerland' && division = 'Basel-Stadt')
  .orderBy({date.desc()})
  .project({genbankAccession, date, unaligned_main, main, S})
  .limit(20)