Create a Neon project and add data
Create a Neon account
If you do not have a Neon account, navigate to the Sign-in page and create an account using your GitHub or Google account.
Create a project
After you have signed in, click on Create a project. Enter a name for your project or let Neon generate one for you, select a PostgreSQL version and a region region, and clock Create project. We recommend selecting the region closest to your application or user location.
What happens behind the scenes
You may have noticed that your project was created in just a few seconds. That’s one of the benefits of Neon’s serverless architecture.
Neon is serverless PostgreSQL that separates compute and storage. Because a Neon compute node is a stateless PostgreSQL instance, Neon can provision one very quickly.
Neon also suspends a compute node if it is inactive for five minutes, to save on compute resources. This is Neon's scale-to-zero feature.
If you navigate to the Endpoints page in the Neon Console, you can view how an endpoint switches from an Active
to an Idle
states after a five minutes of inactivity. Active means that the compute node is running. Idle
, on the other hand, means that the compute node is suspended.
Learn more about Neon’s architecture.
Create a table
This tutorial uses "shoe" data collected from Nike.com’s website using Nike’s API.
To create a table for the shoe data:
- Navigate to the Neon Console.
- Select your project.
- Select SQL Editor from the sidebar.
- Select a branch and a database. This tutorial uses the
main
branch and the defaultneondb
database. - Enter the following query into the editor and click Run or use the shortcut
⌘+Enter
.
CREATE TABLE IF NOT EXISTS shoes (
id SERIAL PRIMARY KEY,
brand VARCHAR(255) NOT NULL,
model VARCHAR(255) NOT NULL,
description VARCHAR(255) NOT NULL,
color VARCHAR(255) NOT NULL,
image VARCHAR(255) NOT NULL
);
The editor should report that the request ran successfully.
Insert data into the shoes table
In this step, you will add a row of data to the shoes
table. In the SQL Editor, enter the following query:
INSERT INTO shoes ("brand", "model", "description", "color", "image") VALUES ('Nike', 'Air Zoom Alphafly', 'Men''s Road Racing Shoes', 'Scream Green/Bright Crimson/Honeydew/Black', 'https://static.nike.com/a/images/c_limit,w_400,f_auto/t_product_v1/c24ddc33-6e38-4cc9-b548-dc48cd3528ea/image.jpg');
tip
You can find more sample data in the migrate.sql
file available in our examples
repository on GitHub.
To add more rows of data, copy INSERT
queries from the migrate.sql
file and run them in the SQL Editor.