To browse and edit a PostgreSQL database on Light Cloud without a SQL client, open the database in the console and click the Data tab. It lists every table. Click a table to see its rows, click a row to edit it, and use Insert row , Columns and New to add rows, columns and tables.
This is part 2 of the database series. It uses the bookshop-db database and sample data from part 1.
What you will do
In the bookshop database, you will:
- change the stock of one book,
- add a new book,
- add an
isbncolumn tobooks, - create a
reviewstable and add reviews, - delete a row safely.
Before you start
- The
bookshop-dbdatabase with the sample data, from part 1. - A Light Cloud account on the Lite plan or higher.
Nothing to install: everything happens in the browser.
Step 1: Open a table
- In the Light Cloud console, click bookshop-db in the sidebar.
- Open the Data tab.
- Click books in the table list.
The table shows 50 rows per page. Click a column name to sort by it. Nothing you do while browsing changes the data.
Step 2: Edit a row
The Dispossessed is back in stock. Click its row. The Edit row window shows every column with its type, and whether it may be empty (not null means it may not):
- Change in_stock from
0to6. - Click Save changes.
Only the fields you changed are saved, so you cannot overwrite a column you did not touch. The console confirms with Row updated.
Step 3: Insert a row
Click Insert row above the table and fill in a new book:
| Field | Value |
|---|---|
| id | leave empty |
| title | Mort |
| author_id | 2 |
| year | 1987 |
| price | 8.99 |
| in_stock | 10 |
Click Insert. Empty fields get the column's default, so PostgreSQL picks the next id, 10. author_id 2 is Terry Pratchett in the authors table.
Step 4: Add a column
The shop wants to store ISBNs. Click Columns above the table, then Add column :
- Name it
isbn. - Choose the type text.
- Leave NULL ticked, so existing books may have no ISBN yet.
- Click the green tick.
Changes in this window apply at once. The pencil next to a column renames it, and the bin drops it. Click Done. Every book now has an isbn column showing NULL, which means empty.
Step 5: Create a table
Readers want to leave reviews. Click New next to Tables and fill in the New table window:
-
Table name :
reviews. - The first column is already there:
id, type serial , PK ticked. serial numbers new rows automatically, and PK makesidthe primary key. - Second column:
book_id, type integer , NULL not ticked. - Click Add column. Third column:
rating, type integer , NULL not ticked. - Click Add column. Fourth column:
body, type text , NULL ticked.
Click Create table. reviews appears in the table list, empty. Add two reviews with Insert row , leaving id empty each time:
-
book_id10,rating5,bodyFunny, kind and about Death. -
book_id1,rating1,bodytest
Keep a primary key on every table you create here: the data explorer can only edit rows of tables that have one.
Step 6: Delete a row safely
The second review was a test. Tick its checkbox, then click Delete selected :
The console asks first, and says how many rows will go:
Check the number, then click Delete row. To delete a single row, you can also open it and click Delete row... in the Edit row window.
Deleting cannot be undone, and neither can dropping a column or a table. Before a big cleanup, download a backup from the Backup tab; part 4 shows how.
Check the result
Open books again and click id to sort. The Dispossessed has 6 in stock, Mort is book 10, and every book has an empty isbn:
The same changes are visible to anything that connects to the database, such as psql or your app.
Troubleshooting
Clicking a row does nothing
The table has no primary key, so the explorer cannot tell rows apart; the header above the rows says read-only - no primary key. Add a primary key with SQL, or edit such tables with SQL.
Could not save the row
The window shows the database's reason. The most common: a not null field left empty, or text in a number field.
Could not add the column
Adding a column that may not be empty fails on a table that already has rows, because the existing rows would have no value. Leave NULL ticked, fill in the values, and tighten the rule later with SQL.








Top comments (0)