Database Quick Start
Learn how to work with your database in just a few minutes.
1. Where to Write Queries
You have two main places to write database queries:
Supabase Dashboard
For direct database management and testing queries:
- Go to your Supabase project dashboard
- Click on "SQL Editor" in the sidebar
- Write and run your queries
In Your Code
For application features, write queries in your server components or API routes:
// In any server component (pages with no "use client")import { createClient } from '@/utils/supabase/server'export default async function Page() {const supabase = await createClient()const { data } = await supabase.from('your_table').select('*')}
2. Basic Operations
Get Data
// Get all profilesconst { data } = await supabase.from('profiles').select('*')// Get specific profileconst { data } = await supabase.from('profiles').select('*').eq('id', userId)
Add Data
// Add a new profileconst { data } = await supabase.from('profiles').insert({id: userId,full_name: 'John Doe',email: 'john@example.com'})
Update Data
// Update a profileconst { data } = await supabase.from('profiles').update({ full_name: 'Jane Doe' }).eq('id', userId)
Delete Data
// Delete a profileconst { data } = await supabase.from('profiles').delete().eq('id', userId)
3. Available Tables
users
Core user data including profile information, billing details, and terms acceptance
customers
Stripe customer data and subscription status
products
Available subscription products and their metadata
prices
Product pricing information and subscription intervals