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
- Add a line of data using the command:
- INSERT INTO <tablename> ( <column-name1>, <column-name2>, .... <column-nameN> VALUES ( <value1>, <value2> ... <valueN> );
- 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.










