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
In questa pagina del sito puoi guardare il video online SQL Tutorial - INSERT della durata di online in buona qualità , che l'utente ha caricato BeardedDev 19 aprile 2017, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 491 volte e gli è piaciuto 11 spettatori. Buona visione!