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 - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Inserting records into tables8m
-
(Locked)
Updating data records7m 33s
-
(Locked)
Challenge: Inserting and updating records1m 30s
-
(Locked)
Solution: Inserting and updating records7m 30s
-
(Locked)
Deleting specific records9m 41s
-
(Locked)
Deleting all records with TRUNCATE10m 28s
-
(Locked)
Challenge: Deleting records1m 32s
-
(Locked)
Solution: Deleting records8m 16s
-
(Locked)
-
-
-
-
-