0% found this document useful (0 votes)
15 views3 pages

Lập Trình Windows Bài Tập Chương 2 HỌ TÊN: Nguyễn Tấn Phát MSSV: 2154810024

This document contains the SQL code to create 7 tables in a database: Categories, Customers, OrderDetails, Orders, Products, Progresses. Each table creation statement specifies the table name, columns with data types, primary keys, and other properties. The tables are being created to store data for an online shopping database that tracks categories, customers, order details, orders, products, and order progress statuses.

Uploaded by

phatjnvaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

Lập Trình Windows Bài Tập Chương 2 HỌ TÊN: Nguyễn Tấn Phát MSSV: 2154810024

This document contains the SQL code to create 7 tables in a database: Categories, Customers, OrderDetails, Orders, Products, Progresses. Each table creation statement specifies the table name, columns with data types, primary keys, and other properties. The tables are being created to store data for an online shopping database that tracks categories, customers, order details, orders, products, and order progress statuses.

Uploaded by

phatjnvaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

LẬP TRÌNH WINDOWS

BÀI TẬP CHƯƠNG 2


HỌ TÊN: Nguyễn Tấn Phát
MSSV: 2154810024
USE [QLBH1]
GO
/****** Object: Table [dbo].[Categories] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Categories](
[CategoryID] [bigint] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](100) NOT NULL,
[Orders] [int] NOT NULL,
[Status] [bit] NOT NULL,
PRIMARY KEY CLUSTERED
(
[CategoryID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON
[PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Customers] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Customers](
[CustomerID] [bigint] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](100) NOT NULL,
[Gender] [bit] NULL,
[Birthday] [date] NULL,
[Address] [nvarchar](250) NOT NULL,
[Phone] [nchar](10) NULL,
[Email] [nvarchar](100) NULL,
[Startus] [bit] NOT NULL,
PRIMARY KEY CLUSTERED
(
[CustomerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON
[PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[OrderDetails] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[OrderDetails](
[OrderID] [bigint] NOT NULL,
[ProductID] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED
(
[OrderID] ASC,
[ProductID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON
[PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Orders] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Orders](
[OrderID] [bigint] IDENTITY(1,1) NOT NULL,
[OrderDate] [date] NOT NULL,
[OrderTime] [time](7) NOT NULL,
[ReceiveDate] [date] NOT NULL,
[ReceiveTime] [time](7) NOT NULL,
[ReceiveAddress] [nvarchar](250) NOT NULL,
[CustomerID] [bigint] NOT NULL,
[ProgressID] [int] NOT NULL,
PRIMARY KEY CLUSTERED
(
[OrderID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON
[PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Products] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Products](
[ProductID] [bigint] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](200) NOT NULL,
[Description] [nvarchar](1000) NOT NULL,
[NormalPrice] [decimal](18, 2) NULL,
[Price] [decimal](18, 2) NOT NULL,
[Quantity] [int] NOT NULL,
[CategoryID] [bigint] NOT NULL,
[ImageFile] [nvarchar](200) NULL,
[Status] [bit] NOT NULL,
PRIMARY KEY CLUSTERED
(
[ProductID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON
[PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Progresses] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Progresses](
[ProgressID] [int] IDENTITY(1,1) NOT NULL,
[Name] [nchar](15) NOT NULL,
PRIMARY KEY CLUSTERED
(
[ProgressID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON
[PRIMARY]
) ON [PRIMARY]
GO

You might also like