How to Add Data to a Mysql Database One Line at a Time

Data can be added to a MySQL table one row at a time, or loaded from a data file. This entry gives the SQL query to add one line at a time.

[edit] Steps

  1. Add a line of data using the command:
    • INSERT INTO <tablename> ( <column-name1>, <column-name2>, .... <column-nameN> VALUES ( <value1>, <value2> ... <valueN> );
  2. Check the data:
    • SELECT * FROM <tablename>


[edit] Tips

  • Values must be listed in the same order as the columns
  • If you don't list all the column values, the rest of the columns will be assigned the default value (or left blank if no default value).
  • If you're entering values for all the columns, then you don't need to give the column list.
  • The column list (if given) must be the same length as the values list.


Embed this: Republish this entire article on your blog or website.

Was this article accurate? Yes No

Edit This Page E-mail this to a Friend Printable version
Discuss This Page Thank the Authors Write an Article
Categories:Software

Authors

Sharimo1, Maluniu, Samnav, Dvortygirl
Thanks to all authors for creating a page that has been read 446 times.

Related wikiHows

Hide These Ads - Why?


Hide These Ads - Why?
Show Ads

Navigation

Editing Tools

My Pages