From the course: MySQL Essential Training (2019)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Inserting data

Inserting data

- [Instructor] The insert into statement is used to add a row or rows to a table. For this lesson we'll use the scratch database here in my MYSQL workbench. I'm connected with my admin connection and I will use scratch like this. And I'll execute that and we're now using the scratch database. So if I select asterisk from customer we'll see the whole customer table here. And you can see it has three rows, Bill Smith, Mary Smith, Bob Smith. They're the Smiths. And so I can insert into customer and list the columns that I want to add data to, so name, address, city, state, zip, and then the values clause is where I list the actual data. So I can say, Fred Flinstone 123, let's put it in quotes, Cobblestone Way, and he's in Bedrock which, as we all know, is in California. I'm just kidding. I don't think it's in any state. Nor does it have a zip code but we're going to go ahead and give it one, 91234. And close the parentheses and put in a semicolon. And now when I execute this it will…

Contents