- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we insert data into a MySQL table?
For inserting data into a MySQL table we need to use INSERT INTO command. We must have to specify values for all the columns of the table in INSERT INTO command.
INSERT INTO table_name values(value1,value2,…)
Suppose we have a table named ‘Student’ with three columns ‘RollNo’, ‘Name’ and ‘Class’ then with the help of following query we can add new rows to the table −
mysql> INSERT INTO Student values(50,'Harshit',’B.tech’); Query OK, 1 row affected (0.07 sec) mysql> INSERT INTO Student values(56,'Amit',’M.tech’); Query OK, 1 row affected (0.05 sec) mysql> Select * from Student; +---------+-------------+-----------+ | RollNo | Name | Class | +---------+-------------+-----------+ | 50 | Harshit | B.tech | | 56 | Amit | M.tech | +---------+-------------+-----------+ 2 rows in set (0.00 sec)
- How can we insert a new row into a MySQL table?
- How can we insert data into an existing MySQL table by using PHP script?
- How can we import data from .txt file into MySQL table?
- How can we import data from .CSV file into MySQL table?
- How to write MySQL procedure to insert data into a table?
- How can we use INSERT() function to insert a new string into the value of a column of MySQL table?
- How can we insert values into a table with the help of MySQL self-computed output?
- How can we export all the data from MySQL table into a text file?
- How can we export all the data from MySQL table into a CSV file?
- Insert JSON into a MySQL table?
- How can we use WHERE clause with MySQL INSERT INTO command?
- How can we insert current date automatically in a column of MySQL table?
- Can we insert records in a MySQL table without auto_increment values?
- How to insert Binary data into a table using JDBC?
- MySQL INSERT INTO SELECT into a table with AUTO_INCREMENT