SQL checks: PASS

SQLite inside Nitro

SQLite 3.40.1 · Database 20480 bytes · Integrity check: ok

Database file: /mnt/appdata/sqlite-basic-9e690f6ae1374c7fa3f7315c67001cd4.sqlite3

SQLite executes inside the enclave. This example uses plain Capsule hostfs and synthetic data; it does not encrypt the backing file.

Complete SQL results · Run the accounts SELECT now

Accounts

SELECT name, balance_cents FROM accounts ORDER BY id
[
  {
    "name": "Alice",
    "balance_cents": 8750
  },
  {
    "name": "Bob",
    "balance_cents": 5750
  },
  {
    "name": "Carol",
    "balance_cents": 3000
  }
]

Transfers

SELECT t.id, a.name AS sender, b.name AS receiver, t.amount_cents
                        FROM transfers t JOIN accounts a ON a.id=t.sender_id
                        JOIN accounts b ON b.id=t.receiver_id ORDER BY t.id
[
  {
    "id": 1,
    "sender": "Alice",
    "receiver": "Bob",
    "amount_cents": 1250
  },
  {
    "id": 2,
    "sender": "Bob",
    "receiver": "Carol",
    "amount_cents": 500
  }
]

Totals

SELECT COUNT(*) AS accounts, SUM(balance_cents) AS total_cents FROM accounts
[
  {
    "accounts": 3,
    "total_cents": 17500
  }
]

Sent By Person

SELECT a.name, SUM(t.amount_cents) AS sent_cents
                             FROM transfers t JOIN accounts a ON a.id=t.sender_id
                             GROUP BY a.id, a.name ORDER BY a.id
[
  {
    "name": "Alice",
    "sent_cents": 1250
  },
  {
    "name": "Bob",
    "sent_cents": 500
  }
]