Recall & Review
beginner
What is expo-sqlite used for in React Native?
It is a library that allows you to use a lightweight SQL database (SQLite) inside your React Native app to store and manage data locally on the device.
Click to reveal answer
beginner
How do you open or create a database using expo-sqlite?
You use
SQLite.openDatabase('name.db') which opens the database if it exists or creates it if it doesn't.Click to reveal answer
intermediate
What method is used to run SQL commands like creating tables or inserting data?
You use
db.transaction(tx => { tx.executeSql(sql, params, success, error) }) to run SQL commands inside a transaction.Click to reveal answer
intermediate
Why do we use transactions when working with expo-sqlite?
Transactions ensure that a group of SQL commands run safely together. If one command fails, the whole transaction can be rolled back to keep data consistent.
Click to reveal answer
intermediate
How can you retrieve data from the database using expo-sqlite?
Inside a transaction, use
executeSql with a SELECT query. The results are in the resultSet.rows._array property inside the success callback.Click to reveal answer
Which function opens or creates a SQLite database in expo-sqlite?
✗ Incorrect
The correct method to open or create a database is SQLite.openDatabase('mydb.db').
What is the purpose of the transaction method in expo-sqlite?
✗ Incorrect
Transactions group SQL commands so they run safely together, ensuring data integrity.
Where do you find the rows returned by a SELECT query in expo-sqlite?
✗ Incorrect
The rows returned are inside resultSet.rows._array in the success callback.
Which SQL command creates a new table in expo-sqlite?
✗ Incorrect
The correct SQL syntax to create a table if it doesn't exist is CREATE TABLE IF NOT EXISTS.
What happens if one SQL command fails inside a transaction?
✗ Incorrect
Transactions ensure all commands succeed or none do, so failure rolls back all changes.
Explain how to create a simple table and insert data using expo-sqlite in React Native.
Think about opening the database, then running SQL commands inside a transaction.
You got /5 concepts.
Describe how to retrieve and display data from a SQLite database using expo-sqlite.
Focus on running a SELECT query and accessing the results in the callback.
You got /5 concepts.