From the course: SQL Server 2014 Essential Training
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
INSERT statements - SQL Server Tutorial
From the course: SQL Server 2014 Essential Training
INSERT statements
- In this section, I'd like to talk about using SQL to create a new record in an existing table. We're going to do this by executing the Insert command. Insert will create one new record in an existing table. For this example I'd like to work with the HumanResources.Department table, it's just a little simpler than some of the previous tables we worked with. I'll open up a New Query and I'll do a SELECT * FROM HumanResources.Department just so we can kind of look at the data and see what we're getting ourselves into. When we execute that, we see the table has four fields, DepartmentID, Name, GroupName and ModifiedDate, so all pretty straightforward columns. Now I'll open up a New Query and in the New Query I want to create the Insert statement. I'll type in the keyword INSERT INTO with a space in between, INSERT INTO. Then the name of the table I would like to insert into, which in this case is HumanResources.Department. Then I'll need to list out all of the fields that I'm going to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
What is SQL?3m 34s
-
(Locked)
Basic SELECT statement3m 35s
-
(Locked)
Filtering results with a WHERE clause3m 48s
-
(Locked)
Using wildcards in a WHERE clause2m 38s
-
(Locked)
Sorting results with ORDER BY4m 48s
-
(Locked)
INSERT statements4m 24s
-
(Locked)
UPDATE statements3m 12s
-
(Locked)
DELETE statements2m 42s
-
(Locked)
-
-
-
-
-
-
-
-
-