From the course: MySQL Essential Training

Unlock this course with a free trial

Join today to access over 23,700 courses taught by industry experts.

Inserting data

Inserting data

- [Bill] Hi, I am Bill Weinman. The insert into statement is used to add rows to a table. For this lesson, we use the scratch database. So here in the workbench with the admin connection, I'll type USE scratch, and that opens our scratch database for our use. And I'll type SELECT * FROM customer. And that will list the contents of the customer table in the scratch database. Now you see we have three rows and six columns. The six columns are the id column, which is the primary key, followed by name, address, city, state and zip. Now if I want to add a row, I say INSERT INTO customer, and then in parentheses, I give it the names of the columns that I'm going to be specifying data for. So I say name, address, city, state and zip, and then the keyword VALUES after which in parentheses, I give it the values that I'm going to put in to those columns in the order that I specified the columns. So I say, first one will be the name, we'll give it Fred Flintstone. (keyboard tapping) And the…

Contents