Amazon Quantum Ledger Database (Amazon QLDB)
Developer Guide

Step 3: Query the Tables in a Ledger

After creating tables in an Amazon QLDB ledger and loading them with data, you can run queries to review the vehicle registration data that you just inserted.

In this step, you use SELECT statements to read data from the tables in the vehicle-registration ledger.

To query the tables

  1. Open the Amazon QLDB console at https://console.aws.amazon.com/qldb.

  2. In the navigation pane, choose Query editor.

  3. Choose the vehicle-registration ledger.

  4. In the query editor window, enter the following statement to query the Vehicle table for a VIN that you added to the ledger, and then choose Run.

    SELECT * FROM Vehicle AS v WHERE v.VIN = '1N4AL11D75C109151'
  5. Then, join Vehicle with VehicleRegistration to get the related registration information. These vehicles are newly added to the ledger and have yet to be registered to owners.

    Enter the following statement, and then choose Run.

    SELECT v.VIN, r.LicensePlateNumber, r.State, r.City, r.Owners FROM Vehicle AS v, VehicleRegistration AS r WHERE v.VIN = '1N4AL11D75C109151' AND v.VIN = r.VIN

    You can also join the Person and DriversLicense tables to see attributes related to the drivers who were added to the ledger.

    Repeat this step for the following.

    SELECT * FROM Person AS p, DriversLicense as l WHERE p.GovId = l.LicenseNumber

To learn about modifying documents in the tables in the vehicle-registration ledger, see Step 4: Modify Documents in a Ledger.