Back to articles list Articles Cookbook
6 minutes read

Course of the Month: How to INSERT, UPDATE, DELETE Data

So, you've started learning SQL, and you already know what the SELECT command is and when to use it! Congratulations! Now, it's time to take the next step towards becoming an expert. You need to know the SQL UPDATE, INSERT, and DELETE commands to modify data in your tables. These are the basics that will allow you to work with tables. But what's the best way to learn them? I asked Agnieszka Kozubek-Krycuń, Chief Content Officer at Vertabelo. In this article, she answers your questions about our October SQL Course of the Month: How to INSERT, UPDATE, and DELETE Data in SQL.

How to INSERT, UPDATE, and DELETE Data in SQL

Let's start at the beginning. INSERT, UPDATE, and DELETE are SQL commands, right?

Yes. They are SQL commands in the same way that SELECT is an SQL command. As you probably know, SELECT allows you to retrieve data from a database, filter it, and perform computations on it. INSERT, UPDATE, and DELETE allow you to modify data in tables. INSERT adds new rows to a table, UPDATE modifies existing data in a table, and DELETE removes rows from a table.

In computer programming, we use the acronym CRUD—create, retrieve, update, and delete—to describe the four basic operations you can do on data. The four SQL commands SELECT, INSERT, UPDATE, and DELETE allow you to perform these four basic data operations in SQL databases.

So, the topic of the course is the basis of SQL, without which you can hardly write queries?

The INSERT, UPDATE, and DELETE commands are essential for working with data and databases. They are the commands used to populate data in a database. Without these commands, you’d have no data in the database and your queries would not return anything.

These commands can be used by database operators to add or modify data manually. However, most frequently, these commands are used by applications and scripts to add data into a database automatically. So, the knowledge of INSERT, UPDATE, and DELETE is essential for software engineers, database administrators, data engineers, and anyone who works with the technical side of databases.

That said, not everyone will use INSERT, UPDATE, and DELETE in their job. Depending on your role, you may not need these commands. If you’re a Data Analyst and your role is to prepare reports and get insights from data, you may only use the SELECT command in your job. The data will be given to you. In fact, you may not have permission to use INSERT, UPDATE, and DELETE on your database.

Either way, it’s good to know INSERT, UPDATE, and DELETE, or at least be aware of their existence to have a fuller understanding of how a database works. It is always worth knowing how something works and be able to apply it if necessary.

Can you show me the use of these commands with specific examples?

Suppose we have a table with LearnSQL.com courses and it contains only one course, SQL Basics.

courses

idtitlecategory
1SQL Basicsbasic

We want to add a new course How to INSERT, UPDATE, and DELETE Data in SQL into the table. We can run this INSERT command:

INSERT INTO courses (id, title, category)  
VALUES (2, ‘How to INSERT, UPDATE, and DELETE Data in SQL’, ‘basic’);

And voila, a new course is now present in the courses table.

courses

idtitlecategory
1SQL Basicsbasic
2How to INSERT, UPDATE, and DELETE Data in SQLbasic

This is of course the simplest example. But imagine you have a website. Every minute someone creates a new account. Their login, password hash, and other data must be in the database to be able to verify them later when logging in.

Each time a user registers on the website, the SQL INSERT and UPDATE commands are run behind the scenes. When the user wants to delete an account, the DELETE command is used.

We are talking about thousands or, as in the case of global servers, millions of users. Here, databases and SQL save the day.

What will I learn from this course? How long does it take?

There are 52 exercises in the course, divided into four parts. We estimate that it takes about eight hours to complete the course.

We start with the basic syntax of the INSERT, UPDATE, and DELETE commands. You’ll learn how to add new rows to a table with INSERT, how to modify existing rows in a table with UPDATE, and how to remove rows from a table with DELETE.

Then we discuss the less frequently used features of these commands: working with NULLs, inserting data from one table into another table, updating using values from another table, and working with default values. Finally, we wrap up with a short quiz for you to review everything you learned in the course.

Is it part of a larger track?

SQL From A To Z

Yes, this course is part of our SQL From A To Z track. This is a complete SQL learning track for beginners who are looking for a comprehensive set of courses to learn all features used in modern SQL, including those used frequently and infrequently. We chose this track to be the SQL track of the season for Fall 2020.

The course is also part of the SQL Fundamentals mini-track. This track is for beginners who want to learn the foundations of SQL and quickly become productive in SQL.

Who should take this course?

The course will be useful for current or aspiring IT professionals: programmers, software engineers, data engineers, database administrators (DBAs), database designers, essentially anyone who plans to work with data. Does this describe you? Doing our course will increase your skills and make you a more aware SQL user.

The course can also be helpful to computer science students taking database classes. Additionally, the course will be beneficial to anyone working with databases: data analysts, data scientists, testers, hobbyists.

Anyone who wants to have the complete picture of SQL, including data manipulation commands, will benefit from completing this course.

Will I receive a certificate to post on my LinkedIn profile?

Yes. As with all our courses, after completing the exercises in the course, you’ll receive a PDF certificate that you can publish on your LinkedIn profile. See how easy it is to do by reading our short guide.

Do you remember working on this course?

Not many people know this, but this was the first course we worked on for the platform. Five years ago, when we had the idea to create an interactive platform for learning SQL, we started with a course on INSERT, UPDATE, and DELETE commands as a “proof of concept” for the idea.

We wrote the first part of the course just to see if the whole thing made sense. Our main SQL course, SQL Basics, was the second course we started to work on.

This course was initially shorter: it consisted of what is now the first part of the course and had less than 20 exercises. After some time, we extended the course with three more parts to offer a comprehensive course on the INSERT, UPDATE, and DELETE commands.

Special Offer for “How to INSERT, UPDATE, and DELETE Data in SQL”!

Yes! We have something special for our users. Throughout October, the course How to INSERT, UPDATE, and DELETE Data in SQL is FREE!

You can get full access to this great interactive course without paying anything. Sign up and start learning today! Learn how to create reports and effective analysis using SQL. Become a pro and achieve more!