> ## Documentation Index
> Fetch the complete documentation index at: https://docs.basic.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Database (get, add, delete, etc.)

> Learn how to access data using the Expo / RN SDK

Use these methods on any table. You'd select a table using `db.from(*insert table name*)`, and chain it with any of the following methods:

* `getAll()`
* `get(id)`
* `add(value)`
* `update(id, value)`
* `replace(id, value)`
* `delete(id)`

<Note> Make sure not to create any `id` or `created_at` field since these are reserved and exist with every row. You can access them with the `get` operators</Note>

### Get all records

```js theme={null}
const allNotes = await db.from('notes').getAll();
```

* **Method:** `getAll()`
* **Returns:** Query builder for chaining (see [filtering and ordering](/basic-expo-rn/rn-filtering) for instructions)

### Get by ID

```js theme={null}
const note = await db.from('notes').get('note-id-here');
```

* **Method:** `get(id)`
* **Returns:** Record object or throws if not found

### Add a record

```js theme={null}
const newNote = await db.from('notes').add({...});
```

* **Method:** `add(value)`
* **Returns:** The newly added record

### Update a record

```js theme={null}
const updated = await db.from('notes').update('noteId', { completed: true })
```

* **Method:** `update(id, value)`

### Replace a record

```js theme={null}
const replaced = await db.from('notes').replace('noteId', {...})
```

* **Method:** `replace(id, value)`

### Delete a record

```js theme={null}
const deleted = await db.from('notes').delete('noteId')
```

* **Method:** `delete(id)`
