SQL Tutorial - INSERT

Veröffentlicht am: 19 April 2017
auf dem Kanal: BeardedDev
491
11

This video will teach you how to INSERT data into a table with working examples, within SQL Server, we also look at the different types of INSERT statements that can be run including INSERT SELECT.

Statements:

INSERT INTO dbo.Customers (C_First_Name, C_Middle_Name, C_Last_Name, C_1st_Line, C_2nd_Line, C_City, C_PostCode, C_Tel, C_Email, C_DOB)
VALUES ('Anne', 'Marie', 'Smith', '62 The Grove', 'Southbridge', 'London', 'SE1 2SH', '0207 556 1234', 'anne.smith@email.com', '19840123')

INSERT INTO ‘table_name’ (‘column names’)
VALUES (‘values’)

INSERT INTO dbo.Customers (C_First_Name, C_Last_Name, C_Tel, C_Email, C_DOB)
VALUES ('Charlie', 'Hawkins', '07789456789', 'charlieh@email.com', '19610527')

INSERT INTO dbo.Books (P_Title, P_Author, P_Year, P_BarCode, P_Stock, P_Type)
VALUES ('The Sense of an Ending', 'Julian Barnes', 2012, (SELECT MAX(P_BarCode) FROM dbo.Books) + 1, 10, 'Paperback')
, ('The Boy in the Striped Pyjamas', 'John Boyne', 2008, (SELECT MAX(P_BarCode) FROM dbo.Books) + 2, 10, 'Paperback')
, ('Lolita', 'Vladimir Nabokov', 2000, (SELECT MAX(P_BarCode) FROM dbo.Books) + 3, 10, 'Hardback')

INSERT INTO dbo.Customers (C_First_Name, C_Last_Name, C_1st_Line, C_City, C_Email, C_DOB)
SELECT FirstName, Surname, [1st Line of Address], City, Email, DOB FROM dbo.Customers_Excel

INSERT statements (DML) are covered in the Microsoft Exam – Querying SQL Server (70-461) 2012 / 2014.

To learn how to backup and restore databases check out the video below:
SQL Tutorial – Backup and Restore
   • SQL Tutorial -  Backup and Restore  

To learn how to UPDATE data in a database check out the video below:
   • SQL Tutorial - UPDATE  

To learn how to use the Import and Export Wizard in SQL check out the video below:
   • SSIS Tutorial - Import and Export Wizard  


Auf dieser Seite können Sie das Online-Video SQL Tutorial - INSERT mit der Dauer online in guter Qualität ansehen, das der Benutzer BeardedDev 19 April 2017 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 491 Mal angesehen und es wurde von 11 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!