📖 Scenario: You are a developer exploring backend services for your new app. You want to understand the differences between Supabase and Firebase to choose the best one.
🎯 Goal: Create a simple Supabase project that sets up a database table and inserts data, then configure a Firebase-like structure for comparison.
📋 What You'll Learn
Create a Supabase table called users with columns id, name, and email
Add a configuration variable max_users set to 100
Write a query to select all users where id is less than max_users
Add a final configuration to enable realtime updates on the users table
💡 Why This Matters
🌍 Real World
Developers often need to choose backend services like Supabase or Firebase for their apps. Understanding how to set up tables, configure variables, query data, and enable realtime updates is essential.
💼 Career
Backend developers and cloud engineers use these skills to build scalable, realtime applications with modern cloud databases.
Progress0 / 4 steps
1
Create Supabase users table
Create a Supabase table called users with columns id (integer, primary key), name (text), and email (text). Use the exact table and column names.
Supabase
Hint
Use SQL syntax to create the table with the exact column names and types.
2
Add configuration variable max_users
Add a configuration variable called max_users and set it to 100 in your Supabase project settings or as a constant in your code.
Supabase
Hint
Define max_users as a constant with value 100.
3
Query users with id less than max_users
Write a Supabase query to select all users where id is less than the variable max_users. Use the exact variable name max_users and table users.
Supabase
Hint
Use Supabase client to query the users table with .lt('id', max_users).
4
Enable realtime updates on users table
Add the final configuration to enable realtime updates on the users table using Supabase's subscription method. Use the exact table name users.
Supabase
Hint
Use supabase.channel with .on('postgres_changes') for realtime updates.
Practice
(1/5)
1. Which database type does Supabase primarily use?
easy
A. SQL (relational database)
B. NoSQL (document database)
C. Graph database
D. Key-value store
Solution
Step 1: Understand Supabase database type
Supabase is built on PostgreSQL, which is a relational SQL database.
Step 2: Compare with other database types
Unlike NoSQL or graph databases, Supabase uses structured tables and SQL queries.
Final Answer:
SQL (relational database) -> Option A
Quick Check:
Supabase = SQL database [OK]
Hint: Supabase uses SQL, Firebase uses NoSQL [OK]
Common Mistakes:
Confusing Supabase with NoSQL databases
Thinking Supabase uses Firebase's database type
Assuming Supabase is a key-value store
2. Which of the following is a correct statement about Firebase?
easy
A. Firebase is managed by Google and uses NoSQL
B. Firebase is open-source and uses SQL
C. Firebase requires manual server setup
D. Firebase only supports relational databases
Solution
Step 1: Identify Firebase management and database type
Firebase is a Google-managed platform that uses NoSQL databases like Firestore.
Step 2: Eliminate incorrect options
Firebase is not open-source, does not use SQL, and does not require manual server setup.
Final Answer:
Firebase is managed by Google and uses NoSQL -> Option A
Quick Check:
Firebase = Google-managed NoSQL [OK]
Hint: Firebase = Google-managed + NoSQL [OK]
Common Mistakes:
Thinking Firebase is open-source
Assuming Firebase uses SQL
Believing Firebase needs manual server setup
3. Given a project requiring complex SQL queries and relational data, which platform is better suited?
medium
A. Firebase, because it supports SQL queries natively
B. Firebase, because it is open-source
C. Supabase, because it uses PostgreSQL with SQL support
D. Supabase, because it uses NoSQL for flexibility
Solution
Step 1: Analyze project needs for complex SQL and relational data
Complex SQL queries and relational data require a relational database with SQL support.
Step 2: Match platform capabilities
Supabase uses PostgreSQL, a relational SQL database, making it suitable. Firebase uses NoSQL and does not support SQL natively.
Final Answer:
Supabase, because it uses PostgreSQL with SQL support -> Option C
Quick Check:
Relational + SQL = Supabase [OK]
Hint: Relational + SQL = Supabase choice [OK]
Common Mistakes:
Choosing Firebase for SQL support
Confusing open-source status
Assuming Supabase uses NoSQL
4. You try to write a SQL query in Firebase's Firestore database and get an error. What is the likely cause?
medium
A. You need to use Firebase CLI to run SQL queries
B. Your SQL syntax is incorrect
C. Firestore requires a special SQL mode enabled
D. Firestore does not support SQL queries; it uses NoSQL syntax
Solution
Step 1: Understand Firestore query language
Firestore is a NoSQL database and does not support SQL queries; it uses its own query syntax.
Step 2: Identify why SQL query fails
Trying to run SQL in Firestore causes errors because SQL is not supported at all, not due to syntax or CLI issues.
Final Answer:
Firestore does not support SQL queries; it uses NoSQL syntax -> Option D
Quick Check:
Firestore = NoSQL, no SQL queries [OK]
Hint: Firestore uses NoSQL, not SQL queries [OK]
Common Mistakes:
Assuming SQL syntax error instead of unsupported query
Thinking Firestore has SQL mode
Believing Firebase CLI runs SQL queries
5. You want to build a real-time chat app with easy setup and tight integration with Google services. Which platform fits best and why?
hard
A. Supabase, because it is open-source and uses SQL
B. Firebase, because it offers real-time database and Google ecosystem integration
C. Supabase, because it supports NoSQL and Google Cloud Functions
D. Firebase, because it requires manual server management
Solution
Step 1: Identify requirements for real-time chat and Google integration
Real-time updates and easy Google service integration are key for this app.
Step 2: Match platform features
Firebase provides a real-time database and is tightly integrated with Google Cloud services, making setup easier.
Step 3: Eliminate incorrect options
Supabase is open-source and SQL-based but less integrated with Google. Firebase does not require manual server management.
Final Answer:
Firebase, because it offers real-time database and Google ecosystem integration -> Option B
Quick Check:
Real-time + Google integration = Firebase [OK]
Hint: Real-time + Google = Firebase best choice [OK]
Common Mistakes:
Choosing Supabase for Google integration
Thinking Firebase needs manual servers
Confusing database types for chat apps
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.