Now that we have a basic database design, the next step is to write SQL to create our first table.  acts like a client
You write SQL in the SQL Editor
Supabase sends that SQL to the PostgreSQL database
PostgreSQL runs it and sends back the result
So yes — you are working with a real PostgreSQL database.
The SQL to Create the cities Table
Now let’s write the SQL.
create table cities (
name varchar(50),
country varchar(50),
population integer,
area integer
);
What this SQL means
create table cities → create a table named cities
Inside ( ... ) we define columns
Each column has:
a column name
a data type
Column Data Types (Simple Explanation)
varchar(50)
Used for text (strings)
(50) means: max length 50 characters
Example: Tokyo, Pakistan, Karachi
So:
name varchar(50) → city name as text
country varchar(50) → country name as text
integer
Used for whole numbers
Example: 100, 50000, 20000000
So:
population integer → population as a number
area integer → area as a number
Common Things to Double Check
Before you run the query:
✅ commas after each line except the last one
✅ parentheses are correct
✅ semicolon ; at the end
After Running the Query
When you click Run:
PostgreSQL creates the cities table in your database
You can see it in Supabase as well:
Go to:
Table Editor → public → cities
You should see the table with these columns:
name
country
population
area
At this point, your table is ready — and in the next step, we can start inserting data into it.
Quick Note
This query created a table successfully, but we will improve it later (for example, adding an id column).
For now, this is perfect for understanding the basics of table creation.
HIRINGMINE CAREER SIGNAL
This writing is proof of expertise.
Explore the author’s verified skills, projects and availability—or start a professional conversation.