From the course: Learning SQL Server 2017

Unlock this course with a free trial

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

Add data with an INSERT statement

Add data with an INSERT statement - SQL Server Tutorial

From the course: Learning SQL Server 2017

Add data with an INSERT statement

- [Instructor] New records can be added in to your data tables using the Transact-SQL key word, Insert. To use it, we'll specify the columns that we want to insert data into, and then supply a list of the values. Let's take a look by first exploring the existing content of the Sales.SpecialDeals table, by creating a new query. I'll type in SELECT * FROM Sales.SpecialDeals When I execute the query, I get the results down below, that shows me that I have two records in this table currently. Now, what I want to do is add in a third item, that'll correspond to a 25% off sale, that'll occur in the month of December. To do this, I'll need to specify a new data point for the special deal ID as number three. We'll need a new deal description, let's go ahead and scroll over here to the right. I want to specify the new start date and end dates for the promotion, the discount percentage, and if I scroll all the way to the right, I'll…

Contents