/supabase-tutorials

How to create a custom table in Supabase?

Step-by-step guide to creating a custom table in Supabase. Learn to set up your project, write SQL, and verify your table quickly.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to create a custom table in Supabase?

 

Step 1:   Set Up Your Supabase Project  

  1. Create an Account and Sign In:
    Navigate to Supabase and create an account if you don't already have one, or sign in to your existing account.

  2. Create a New Project:
    Once logged in, click on 'New Project' to create a new Supabase project. Provide a project name, select a database password, and choose the server region closest to you. Click 'Create New Project' to proceed.

 

Step 2:   Access the Database Page  

  1. Navigate to the Database Section:
    After your project is created, you'll be directed to the Project Overview page. On the left sidebar, click on 'Database' to access the database management section.

 

Step 3:   Open SQL Editor  

  1. Launch the SQL Editor:
    Within the database section, go to 'SQL Editor'. Here, you'll be able to write and execute SQL commands to interact with your database.

 

Step 4:   Write the SQL to Create a Custom Table  

  1. Define Your Table Schema:
    Decide on the structure of the table you need. The table schema involves choosing the table name, along with column names and their respective data types.

  2. SQL Command for Creating a Table:
    Use the following SQL template to create your custom table:

    ```sql
    CREATE TABLE custom_table_name (
    id SERIAL PRIMARY KEY,
    column1_name data_type1,
    column2_name data_type2,
    column3_name data_type3
    );
    ```

    Replace custom_table_name with the name of your table and column1_name, column2_name, etc., with your desired column names and their associated data types (e.g., VARCHAR, INTEGER, TEXT). id SERIAL PRIMARY KEY is a common setup for auto-incrementing unique identifier columns.

 

Step 5:   Execute the SQL Command  

  1. Run the SQL Command:
    Once your SQL is prepared in the SQL editor, click 'Run' or 'Execute' to run the SQL command. This will create your table in the database if your SQL syntax is correct.

  2. Check for Confirmation or Errors:
    After execution, your SQL command's status (success or error) will appear in the console. Verify if the table is created successfully or debug errors if there are any issues with the SQL syntax.

 

Step 6:   Verify Table Creation  

  1. Go Back to the Database Section:
    Navigate back to the database section and look for your new table under the 'Tables' section to ensure it has been created.

  2. Double-check Table Schema:
    Open the table details to verify the table's schema matches what you specified in your SQL command.

 

Step 7:   Manage and Use Your Table  

  1. Insert Data into Your Table:
    Use SQL commands to insert data into your new table and begin utilizing it for your application's needs. Examples of SQL INSERT commands can be found in Supabase documentation or general SQL resources.

  2. Set Up Row Level Security and Policies:
    To secure your data, ensure to establish appropriate Row Level Security (RLS) rules and policies for your table via Supabase's intuitive settings if necessary.

Now you have successfully created and set up a custom table in Supabase!

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022