Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 764 Bytes

File metadata and controls

28 lines (20 loc) · 764 Bytes

SQL Tutorial: The Basics

Chapter 3: CRUD

##INSERT

INSERT INTO [dbo].[ProductData] ([ProductName]) VALUES ('Wasserhahn'), ('Wasser_Hahn')
INSERT INTO [dbo].[ProductData] ([ProductName])
	SELECT [ProductName] FROM [dbo].[Products] WHERE [CategoryID] = 1

##Update Simply uptdate the name of a specific product. In this case we want to update the name of the product with the ID 10:

UPDATE [dbo].[ProductData] SET [ProductName] = 'Outback Black Lager' WHERE [ID] = 10

No we have to increase the unite price of all products we supply from Germany to 10%:

UPDATE [dbo].[Products] SET [UnitPrice] = [UnitPrice] * 1.1
	WHERE [SupplierID] IN (SELECT [SupplierID] FROM [dbo].[Suppliers] WHERE [Country] = 'Germany')