Data can be added to a SQL database with the INSERT query.
This query can be written in the SQLite prompt.
All of the data must be stored in tables.
To add data to a SQLite database, you must first create tables.
You may like:
Learning SQL: Master SQL Fundamentals
First connect to your database with
where database.db is your existing database.
Then see the existing tables with
Choose the table you want to add data to. We created the table EMPLOYEE in the previous article.
We insert data into the table we’ve created in the previous article.
sqlite3> INSERT INTO EMPLOYEE (ID, NAME, EDUCATION, SALARY) VALUES (1, 'Alica', 'Bachelor', 2000);
This will add one new record to the database table EMPLOYEE. You must write both the columns and the values.
One record has been added. Repeat this query with other data to add more records. You can then show data from the table with the SELECT query.
Note: You can use a GUI tool to add data into your SQL database.
Video demonstration of the insert query below