Recall & Review
beginner
What is the sqflite package used for in Flutter?
The sqflite package is used to work with SQLite databases in Flutter apps. It allows you to store, query, update, and delete data locally on the device.
Click to reveal answer
beginner
How do you open or create a database using sqflite?
You use the openDatabase() function from sqflite. It opens an existing database or creates a new one if it doesn't exist, and you can provide a path and version.
Click to reveal answer
intermediate
What is the purpose of the onCreate callback in openDatabase?
The onCreate callback runs when the database is created for the first time. It is used to create tables and set up the initial database structure.
Click to reveal answer
beginner
How do you insert data into a SQLite table using sqflite?
You use the insert() method on the database object, passing the table name and a map of column names to values.
Click to reveal answer
intermediate
What is the difference between rawQuery() and query() methods in sqflite?
rawQuery() lets you write SQL statements as strings for complex queries, while query() provides a simpler, structured way to query tables without writing raw SQL.
Click to reveal answer
Which function is used to open or create a SQLite database in Flutter with sqflite?
✗ Incorrect
openDatabase() is the correct function to open or create a database using sqflite.
What does the onCreate callback do when opening a database?
✗ Incorrect
onCreate is called only once when the database is first created to set up tables and initial data.
How do you insert a new row into a table using sqflite?
✗ Incorrect
The insert() method is used to add new rows to a table.
Which method allows you to run raw SQL queries in sqflite?
✗ Incorrect
rawQuery() lets you run raw SQL statements as strings.
What type of data structure is used to represent a row when inserting data with sqflite?
✗ Incorrect
A Map with column names as keys and values as data is used to represent a row.
Explain the steps to create and open a SQLite database using the sqflite package in Flutter.
Think about how you tell sqflite where the database is and what to do when it is new.
You got /5 concepts.
Describe how to insert and query data from a SQLite database using sqflite.
Consider how you add data and then get it back in a Flutter app.
You got /4 concepts.