Pre populated SQLite database is the database which will be created before its use in mobile development. Developer can manually create the database, tables in database and insert records inside it. To create pre populated database we’ll to use DB Browser for SQLite a free software available. In today’s tutorial we would learn about How to use DB Browser for SQLite for mobile development purpose. So in this tutorial we would discuss about Example of Creating Pre Populated SQLite Database For React Native.
Contents in this project Example of Creating Pre Populated SQLite Database For React Native:
1. Step 1 is to download and install the DB Browser for SQLite in your operating system. Here is the link of their download page, Download the file as per your system.
2. After successfully done downloading, Install the Browser in your system.
3. Click on the DB Browser(SQLite) icon present on your Desktop screen.
4. Click on New Database to create new empty database.
5. Now it’ll ask you to Enter the SQLite database name and Save the database as per your choice location. In this case my SQLite database name is school_details.
6. Not it will open the Edit Table definition window, Enter the Table name then create table fields. After creating all the table fields hit the Enter button to save the table. I’m creating a table named as class10th with 4 fields student_id, student_name, student_phone_number and student_address.
7. Here you go, Now your table has been successfully created. Next step is Inserting Data into table. Click on Brows Data -> Select your Table -> Insert a new record in current table and enter records manually.
8. Click again on Insert a new record in current table icon present on screen and add multiple records as I did in below screenshot.
Note: All the records in this table are completely random and just for testing purpose.
9. Now close the DB Browser SQLite window to save the current records. You can open again the database to seen all the records.
10. Below is the screenshot of my school_details.db database.
Here you go friends, Now your Database is successfully created and ready to use in react native mobile application. In my next tutorial I’ll explain you how to integrate the SQLite database in react native app.