Modifying Data in T-SQL

Reading data is half the story. You will add rows with INSERT, change them with UPDATE, remove them with DELETE, and use transactions as a safety net while you practice.

Updated

Modifying Data in T-SQL

  1. Inserting Data (Apprentice): Add rows to a table with INSERT INTO, name the columns you fill, let identity columns number new rows, and respect the table's keys.
  2. Updating Data (Apprentice): Change existing rows with UPDATE ... SET, always limited by a WHERE that you've tested first with a SELECT.
  3. Deleting Data (Apprentice): Remove rows with DELETE FROM ... WHERE, test the WHERE first, and delete in the order the foreign keys allow.
  4. Transactions (Apprentice): Group changes into a transaction so they all happen or none do, and use ROLLBACK as a safety net while you work.

Exercise: Modifying Data

  1. Exercise: Modifying Data (Apprentice): Add a category, products, yourself and a customer's order to Northwind, then update and delete them, with scripts that use variables and transactions.