TeleportHQ database

How to create database tables (by hand or with AI)

How to create database tables (by hand or with AI)

In TeleportHQ, you add tables to a database from the Add a new table card in the database's panel. Click Create Tables to define the table and its columns yourself, or Create using AI to describe what you need, for example "a bakery shop with products and orders", and let AI build the tables. A table is like a spreadsheet tab: each column is a field, each row is one item.

Before you start

Open the Add a new table card

  1. In the left sidebar, click Data Sources (the database icon).
  2. Click your database card, for example Bakery database.
  3. In the panel that opens, find the Database Tables section. Its Add a new table card has the buttons Create Tables, Import from File, Create using AI and, when the project has a business description from the AI website builder, Generate from Business.
The Add a new table card of a TeleportHQ database, with the Create Tables and Create using AI buttons highlighted

You can also start a table from the table window: click View Data next to any table, then Add new table at the bottom of the Tables list on the left.

Create a table by hand

To create a TeleportHQ database table yourself, for example a products table:

  1. On the Add a new table card, click Create Tables. The table window opens on the Create New Table form.
  2. In Table Name, replace new_table with products. Names use lowercase letters, numbers and underscores.
  3. In the first column, type the Name id, choose the Type INTEGER, and tick Primary Key and Auto Increment. The primary key is the field that tells rows apart, and Auto Increment numbers new rows for you.
  4. Click Add Column, type the name name and choose the type VARCHAR (text).
  5. Click Add Column again, type price and choose NUMERIC (a number with decimals).
  6. For each column, decide whether it may be empty. New columns start with Nullable ticked; untick it to make the field required. Tick Unique if no two rows may share the value.
  7. Click Create Table.
The TeleportHQ Create New Table form with the Table Name field, the Add Column button and the Create Table button highlighted

A message confirms Table "products" created successfully. The Columns tab above the list counts your columns, up to 20, for example Columns (3/20). The Indexes tab lets you add indexes at the same time; see How to add columns and link tables together.

Create tables with AI

To let AI create TeleportHQ database tables from a description:

  1. On the Add a new table card, click Create using AI. The Create Tables with AI window opens, with Example prompts and Tips for better results.
  2. In Describe your tables, write what you need, up to 2,000 characters. For example: A bakery shop: products with name, price, photo and category; orders linked to customers with date, total and status; customers with name, email and phone.
  3. Press Enter, or click Generate Tables. (Shift+Enter starts a new line.)
The TeleportHQ Create Tables with AI window with the Describe your tables box and the Generate Tables button

A message confirms Successfully created N table(s). The tips suggest naming the columns you want, mentioning links between tables ("linked to", "belongs to"), and listing special rules such as unique values or defaults.

Generate tables from your business description

When the project has a business description from the AI website builder, the card also shows Generate from Business ("Uses AI to automatically generate database tables based on the business description you provided during project setup."). Click it: AI creates tables that fit your business, for example menu_items and reservations for a restaurant. A message confirms Successfully created N table(s) from business description. This also uses AI tokens.

Check that it worked

The new tables appear under Database Tables, each with its columns listed and a View Data button. Click it to start adding rows. See How to view, add and edit records.

Troubleshooting

"At least one column must be set as primary key" Tick Primary Key on one column, usually id.

"At least one column with a name is required" Fill in the name of at least one column.

"Foreign key requires table and column selection" You ticked Foreign Key on a column. Choose its References Table and References Column, or untick it.

"You've reached the maximum number of tables for your plan (limit: N). Upgrade your plan or remove unused tables to continue." Your TeleportHQ database has the most tables your plan allows. Remove a table you don't need, or upgrade. See TeleportHQ database limits by plan.

"Maximum 20 columns allowed per table" A table can have at most 20 columns, and Add Column stops working at 20. Split the data into two linked tables.

"order" is a reserved keyword and cannot be used as a column name Some words are reserved by the database, such as order, group, select or table. Use a longer name, for example order_date.

"Failed to generate tables" AI couldn't create the tables. Check that you have AI tokens left, make the description more specific, and try again.

Good to know

  • Name rules: table and column names use letters, numbers and underscores, can't start with a number, can't contain two underscores in a row or end with one, and can be up to 64 characters.
  • Linking tables (for example each order belongs to a customer) is done with a foreign key. See How to add columns and link tables together.
  • Other connected databases that can create tables, such as MongoDB, Firestore, Airtable, ClickHouse and Turso, have no Add a new table card. Use Add new table in their table window instead.
  • Have your data in a spreadsheet already? Import it from a file to create the table and its rows in one step.
Share

Related Articles

How to set up the built-in TeleportHQ database

To add the built-in TeleportHQ database, open Data Sources in the editor's left sidebar, click + (Add Data Source), choose TeleportHQ database and click Setup TeleportHQ Database; TeleportHQ creates a hosted database for the project that you then fill with tables.

How to add columns and link tables together

In TeleportHQ, you change a table's columns in the Structure view of its table window: click Add Column to add a field, the pencil (Edit column) to change one, tick Foreign Key to link a column to another table, and use Recent changes to revert a change you made.

How to import data from a spreadsheet file

In TeleportHQ, Import from File on your database's Add a new table card turns a CSV, Excel (.xlsx), OpenDocument, JSON, SQL dump or SQLite file into new tables with their rows, and the upload button in a TeleportHQ database table's window imports a CSV into that existing table, updating matching rows and adding the rest.

How to view, add and edit records

In TeleportHQ, you manage a database table's rows in its table window, opened with View Data in the Data Sources panel: click Create Record to add a row, double-click a cell to change it, open a row's menu for View Details or Delete Record, and use the SQL view to look up rows with a query.

TeleportHQ database limits by plan

On Pro and Premium, a TeleportHQ database holds up to 200,000 records per table, 3,000,000 records in total and 2 GB, with up to 30 tables, 20 columns per table and 20 indexes; a database created during the trial gets the lower tier (5,000 records per table, 15,000 in total, 50 MB) and becomes inactive after 7 days.

What uses AI tokens, and how much?

In TeleportHQ, every AI feature uses AI tokens for the AI work it really does, so costs vary; as a guide, an AI website page is about 3,000 tokens, a web app page about 15,000, a new section at least 1,500 and a 4-second AI video about 9,000, while stock images cost nothing, a run that fails before the AI works costs nothing, and AI 3D models aren't available yet.