Which data type in Supabase is best suited to store a user's email address to ensure it is stored as text and can be indexed efficiently?
Think about storing strings with a maximum length for emails.
VARCHAR with a length limit is ideal for emails because it stores text efficiently and supports indexing, unlike TEXT which has no length limit and may be less efficient for indexing.
Given a Supabase table for users, which SQL statement correctly adds a NOT NULL constraint to the 'username' column?
Focus on the correct syntax for altering a column constraint in PostgreSQL (used by Supabase).
In PostgreSQL, the correct syntax to add a NOT NULL constraint is ALTER TABLE ... ALTER COLUMN ... SET NOT NULL.
You are designing a Supabase table to store product prices with high precision. Which data type should you choose to avoid rounding errors and maintain accuracy?
Consider data types that store exact numeric values rather than approximate.
DECIMAL or NUMERIC types store exact values with fixed precision, avoiding rounding errors common with FLOAT.
Which SQL command correctly creates a unique constraint on the 'email' column in a Supabase table to prevent duplicate emails?
Look for the syntax that names the constraint explicitly.
Adding a named unique constraint uses ADD CONSTRAINT with UNIQUE keyword in PostgreSQL (Supabase).
Consider a Supabase table with a CHECK constraint: CHECK (age >= 18). What happens if you try to insert a row with age = 16?
Think about how constraints enforce data validity strictly.
CHECK constraints prevent invalid data; inserting a row violating the constraint causes an error and the insert fails.