DML: INSERT Statements
Inserting Values
Suppose dbo.Songs
is empty.
Let’s populate it with some songs.
INSERT INTO dbo.Song
VALUES
('The Tide Is High', 231)
, ('Red Red Wine',182)
, ('Do You Really Want To Hurt Me',263)
, ('Relax',238)
, ('Gold',231);
But, manually entering data into our table in this fashion is really slow and tedious!
Inserting from SELECT
Suppose I’ve got another table, dbo.moreSong
which has… more songs (and conveniently shares the same schema).
INSERT INTO dbo.Song
SELECT
SongName
, Duration
FROM dbo.moreSong;
This essentially copies everything from dbo.moreSong
into dbo.Song
.