-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql-server
More file actions
21 lines (18 loc) · 862 Bytes
/
Copy pathsql-server
File metadata and controls
21 lines (18 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- Create a new database
CREATE DATABASE ToDoApp;
-- Switch to the ToDoApp database
USE ToDoApp;
-- Create the ToDoItems table
CREATE TABLE ToDoItems (
Id INT PRIMARY KEY IDENTITY(1,1), -- Auto-increment primary key
Title NVARCHAR(255) NOT NULL, -- Title of the to-do item
Description NVARCHAR(500), -- Description of the to-do item
IsCompleted BIT NOT NULL DEFAULT 0, -- Flag to check if the item is completed
CreatedAt DATETIME NOT NULL DEFAULT GETDATE(), -- When the item was created
UpdatedAt DATETIME NOT NULL DEFAULT GETDATE() -- When the item was last updated
);
-- Insert some sample data
INSERT INTO ToDoItems (Title, Description, IsCompleted)
VALUES
('Learn ASP.NET Core', 'Study ASP.NET Core MVC and Entity Framework Core', 0),
('Build a Web Application', 'Create a full-stack web app using .NET Core and SQL Server', 0);