From the course: Programming Foundations: Databases

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Modifying data

Modifying data

From the course: Programming Foundations: Databases

Start my 1-month free trial

Modifying data

- [Instructor] While we can query information from a database with SQL, we can also use SQL to modify data, retrieving data or reading it is the R in the CRUD acronym. Let's take a look at the others, create, update, and delete. Let's add a new customer to the database, to do that I'll use the insert keyword and tell the database where I want the data to go with into customers and then I'll provide the column names and the values to insert into them. I'll run that query and then when I ask for the contents of the customers table again, down here at the bottom of the table I can see my new customer was added. The database provided an auto incrementing key to give us a unique value for this customer. Any values we didn't provide are null and that's okay because of the way that we defined this table earlier. We only required that first name, last name, and phone need to not be null. If we left off one of those fields and…

Contents