0
0
Supabasecloud~20 mins

Data types and constraints in Supabase - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Data Types and Constraints Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Data Types in Supabase

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?

ATEXT without length limit
BVARCHAR with a length limit
CINTEGER
DBOOLEAN
Attempts:
2 left
💡 Hint

Think about storing strings with a maximum length for emails.

Configuration
intermediate
2:00remaining
Applying NOT NULL Constraint

Given a Supabase table for users, which SQL statement correctly adds a NOT NULL constraint to the 'username' column?

AALTER TABLE users MODIFY username NOT NULL;
BALTER TABLE users CHANGE username username NOT NULL;
CALTER TABLE users ALTER COLUMN username SET NOT NULL;
DALTER TABLE users ADD CONSTRAINT username NOT NULL;
Attempts:
2 left
💡 Hint

Focus on the correct syntax for altering a column constraint in PostgreSQL (used by Supabase).

Architecture
advanced
3:00remaining
Choosing Data Types for Performance

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?

AFLOAT
BTEXT
CINTEGER
DDECIMAL or NUMERIC
Attempts:
2 left
💡 Hint

Consider data types that store exact numeric values rather than approximate.

security
advanced
3:00remaining
Enforcing Unique Constraints

Which SQL command correctly creates a unique constraint on the 'email' column in a Supabase table to prevent duplicate emails?

AALTER TABLE users ADD CONSTRAINT unique_email UNIQUE (email);
BALTER TABLE users MODIFY email UNIQUE;
CALTER TABLE users ADD UNIQUE (email);
DCREATE UNIQUE INDEX email ON users(email);
Attempts:
2 left
💡 Hint

Look for the syntax that names the constraint explicitly.

service_behavior
expert
3:00remaining
Behavior of CHECK Constraints on Insert

Consider a Supabase table with a CHECK constraint: CHECK (age >= 18). What happens if you try to insert a row with age = 16?

AThe insert fails and raises an error.
BThe insert succeeds but sets age to NULL.
CThe insert succeeds and ignores the constraint.
DThe insert succeeds but logs a warning.
Attempts:
2 left
💡 Hint

Think about how constraints enforce data validity strictly.