-
DAYS
-
HOURS
-
MINUTES
-
SECONDS

Free Beginners SQL Course!

Data Modification

Use Data Modification statements to change data in your database tables.

The database modification statements you’ll use the most are:

  • INSERT
  • UPDATE
  • DELETE

You can also combine these into one operation called MERGE!

I would recommend stating out by reading the article Learn how to Add, Remove, or Modify values in a SQL Table.

Then once you have gotten the basics, dig into more detailed articles on INSERT, UPDATE, and DELETE.

Don’t forget about MERGE!  I would highly recommend reading  Introduction to the Merge Statement once you have master the rest.

All the examples for this lesson are based on Microsoft SQL Server Management Studio and the sample databases AdventureWorks and WideWorldImporters.  You can get started using these free tools using my guide Getting Started Using SQL Server

Latest Posts

  • Find and Remove Duplicates in SQL
    , ,

    ·

    Find and Remove Duplicates in SQL

    Problem You want to remove duplicates in SQL. You know it is easy to find duplicates using GROUP BY, but how do your remove all but one? Background Here’s an example of how to find duplicate records using a window function in SQL: Suppose we have a table of students that includes columns for student…

  • SQL Server Inserting Multiple Rows

    ·

    SQL Server Inserting Multiple Rows

    Problem Statement Getting data loaded into your SQL Server tables can come in a variety of methods. There are many mechanisms that SQL Server offers including BULK INSERT, OPENQUERY, loop logic and subquery inserts to consider. Let’s take a look at a few options that can come into play when you need to load multiple…

  • What is the Difference between TRUNCATE and DELETE?
    ,

    ·

    What is the Difference between TRUNCATE and DELETE?

    In SQL Server there are a couple a ways you can delete rows from a table.   You can use the TRUNCATE and DELETE command.  Though the end result of both commands is the same, there are very important differences you should know about. Let’s explore their differences and learn What is the TRUNCATE command in SQL.…

  • SQL DELETE Statement (Transact SQL)

    ·

    SQL DELETE Statement (Transact SQL)

    Use the DELETE statement to remove rows from a SQL Server data table.  In this article we’ll explore how to use the DELETE statement.  We discuss some best practices, limitations, and wrap-up with several examples. This is the fourth article in a series of articles.  You can start at the beginning by reading Introduction to SQL…

  • SQL ACID Database Properties Explained
    ,

    ·

    SQL ACID Database Properties Explained

    What are the ACID Database Properties? The ACID properties define SQL database key properties to ensure consistent, safe and robust database modification when saved. ACID is an acronym that helps to remember the fundamental principles of a transnational system. ACID stands for Atomic, Consistent, Isolation, and Durability.  Here are some informal definitions: Atomic – Transaction acting on…

  • What is the Difference Between Merge and Update?
    ,

    ·

    What is the Difference Between Merge and Update?

    When modifying one table based on the contents of another it may be tempting to simply use the merge statement, but before you throw away all other forms of modifying data, I think it’s important for you to know the difference between merge and update. What is the Difference Between MERGE and UPDATE? Both the…

  • SQL MERGE Statement (Transact SQL)

    ·

    SQL MERGE Statement (Transact SQL)

    Introduction to the MERGE Statement and SQL Server Data Modification The MERGE statement is used to make changes in one table based on values matched from anther.   It can be used to combine insert, update, and delete operations into one statement.  In this article, we’ll explore how to use the MERGE statement.  We discuss some…

  • Data Manipulation with SQL – The Ultimate Guide

    ·

    Data Manipulation with SQL – The Ultimate Guide

    In this article, we’ll discover data manipulation statements used to modify data in the SQL server using the INSERT, UPDATE, DELETE, and MERGE statements. These are also called DML (Data Manipulation Language) statements. In this article you’ll learn to use these data modification statements to add, modify, and remove data.  Finally, we’ll wrap up the…

  • SQL UPDATE Statement (Transact SQL)

    ·

    SQL UPDATE Statement (Transact SQL)

    Use the SQL UPDATE statement to change data within a SQL Server data table’s columns.  In this article, let’s explore using the UPDATE statement.  We discuss some best practices, limitations, and wrap-up with several examples. This is the third article in a series of articles.  You can start at the beginning by reading Introduction to…

  • SQL INSERT Statement (Transact SQL)

    ·

    SQL INSERT Statement (Transact SQL)

    Use the INSERT statement is to add rows to a SQL Server data table.  In this article we explore how to use the INSERT statement.  We discuss best practices, limitations, and wrap-up with several examples. This is the second article in a series of articles.  The first is Introduction to SQL Server Data Modification Statements.…