From the course: MySQL Database Administration

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

Inserting records into tables

Inserting records into tables - MySQL Tutorial

From the course: MySQL Database Administration

Inserting records into tables

- [Instructor] Alright, now we're ready to talk about inserting new records of data into tables. MySQL makes this very easy by using an INSERT INTO statement, which we'll walk through in a moment. We can either insert one row at a time, or we can do a batch insert with many rows using one SQL statement. Sometimes we'll specify values for every single column in our insert statement, other times we'll leave some columns out. If we leave certain columns out, then MySQL will place the default value for that column into that field. Let's jump into Workbench so you can see how it's done. So let's use our thrift shop schema again, as an example. We run the "use thrift shop" statement so that we are using that schema, and let's use the inventory table as our first example. So in the inventory table, we have inventory ID, item name, and number in stock. So let's say we wanted to add another inventory item. We can run an INSERT INTO. So every time you want to insert records, whether it's one or…

Contents