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 - 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
-
-
-
-
-
-
(Locked)
Create a SELECT statement4m 56s
-
(Locked)
Use functions to calculate values5m 28s
-
(Locked)
Write an UPDATE statement3m 41s
-
(Locked)
Add data with an INSERT statement3m 50s
-
(Locked)
Create a view of the data7m 11s
-
(Locked)
Solution: Select data from a table2m 48s
-
(Locked)
Solution: Join related tables with a query3m 9s
-
(Locked)
Solution: Use functions to calculate values4m 50s
-
(Locked)
Solution: Update the data stored in a table6m 24s
-
(Locked)
-