Given an API and dataset, how would you retrieve specific data using that API?
Assume API request metadata and dataset records are stored in the provided tables. Write a PostgreSQL query that returns only records requested by ready API requests and currently marked active.
request_id, dataset_id, record_key, record_value, and requested_at.requested_at descending, then request_id ascending.| Column | Type | Description |
|---|---|---|
| request_idPK | INT | Unique API request identifier |
| dataset_id | INT | Identifier of the requested dataset |
| requested_key | VARCHAR(30) | Record key requested through the API |
| request_status | VARCHAR(20) | Processing status of the API request |
| requested_at | TIMESTAMP | Time when the request was created |
| Column | Type | Description |
|---|---|---|
| record_idPK | INT | Unique dataset record identifier |
| dataset_id | INT | Identifier of the dataset containing the record |
| record_key | VARCHAR(30) | Key used to identify the record |
| record_value | VARCHAR(100) | Value returned for the record |
| is_active | BOOLEAN | Whether the record is currently available |