A user can insert the data into a MySQL table using SQL INSERT INTO command. It can be done in two ways:-

1.) By using mysql> prompt

2.) By using any script like PHP.

Basic format to insert the data into the table:

In order to have insert string data types, it is important to keep the values into the double or single quote, for example- “value”.

Inserting Data from Command Prompt:

This will use SQL INSERT INTO command to insert data into MySQL table tutorials_table.


The following example will create 3 records into tutorials_table table:

Inserting Data Using PHP Script:

SQL INSERT INTO command into PHP function mysql_query() to insert data into a MySQL table.


The following example takes three different choices from the user and will insert them into MySQL table:


Previous articleSQL Drop Table
Next articleSQL WHERE Clause
Hello Itsourcecoders, welcome to itsourcecode.com. I'm Joken Villanueva, MIT a passionate Blogger, Programmer and a Hobbyist. I started Itsourcecode because I wanted to give back and Share all the learnings and knowledge I've learned in my career and I believe through this website I would be able to help and assist those newbie programmers in enhancing their skills from different programming languages. So let us all help each other by sharing our ideas!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.