Creating a database and some test rows
Every data lesson needs a database with a table and a few rows. Building one takes a minute.
Create the database and table
SQL
CREATE DATABASE Shop;
CREATE TABLE Product (
Id int IDENTITY(1,1) PRIMARY KEY,
Name nvarchar(100) NOT NULL,
Price decimal(10,2) NOT NULL
);Add a few rows
SQL
INSERT INTO Product (Name, Price) VALUES ('Hammer', 12.50);
INSERT INTO Product (Name, Price) VALUES ('Saw', 24.00);
INSERT INTO Product (Name, Price) VALUES ('Drill', 89.99);Why the identifier matters
The identity column gives each row a unique number that the database assigns. That number is how you update and delete a single row precisely.
Test data is for testing. Use obvious, made up values so nobody mistakes them for real records later. Never put real customer data into a practice database.
Now you can read those rows in talking to a database with ADO.NET.