INSERT INTO SQL

I often forget what the INSERT SQL statement format is when I’m adding fields to different MySQL tables. Use the command below to insert a record into your table:

INSERT INTO <table-name> (field1, field2) VALUES (‘field1 value’, ‘field2 value’);

For example, let’s say you need to add a record to the users table. Simply use the following command and you will add a new user to the table:

INSERT INTO users (name, address) VALUES (‘Martin Sheen’,’1600 Pennsylvania Ave’);

Leave a Reply

Your email address will not be published. Required fields are marked *