Perform a SELECT query on the table or view.
range()
queries to paginate through your data.select()
can be combined with Filtersselect()
can be combined with Modifiersapikey
is a reserved keyword if you're using the Supabase Platform and should be avoided as a column name.The columns to retrieve, separated by commas. Columns can be renamed when returned with `customName:columnName`
Named parameters
const \{ data, error \} = await supabase
.from('countries')
.select()
const \{ data, error \} = await supabase
.from('countries')
.select('name')
const \{ data, error \} = await supabase
.from('countries')
.select(`
name,
cities (
name
)
`)
const \{ data, error \} = await supabase
.from('users')
.select(`
name,
teams (
name
)
`)
const \{ data, error \} = await supabase
.from('messages')
.select(`
content,
from:sender_id(name),
to:receiver_id(name)
`)
// To infer types, use the name of the table (in this case `users`) and
// the name of the foreign key constraint.
const \{ data, error \} = await supabase
.from('messages')
.select(`
content,
from:users!messages_sender_id_fkey(name),
to:users!messages_receiver_id_fkey(name)
`)
const \{ data, error \} = await supabase
.from('games')
.select(`
game_id:id,
away_team:teams!games_away_team_fkey (
users (
id,
name
)
)
`)
const \{ data, error \} = await supabase
.from('cities')
.select('name, countries(*)')
.eq('countries.name', 'Estonia')
const \{ data, error \} = await supabase
.from('countries')
.select(`*, cities(count)`)
const \{ count, error \} = await supabase
.from('countries')
.select('*', \{ count: 'exact', head: true \})
const \{ data, error \} = await supabase
.from('users')
.select(`
id, name,
address->city
`)
const \{ data, error \} = await supabase
.from('cities')
.select('name, countries!inner(name)')
.eq('countries.name', 'Indonesia')
const \{ data, error \} = await supabase
.schema('myschema')
.from('mytable')
.select()