(精华)2020年8月22日 ABP vNext Poem相关数据库表的Sql语句
【摘要】
在ABP项目开发系列中,使用Poem作为例子,相关数据库表的Sql语句如下: Poet:
CREATE TABLE [dbo].[Poet](
[PoetID] [int] IDENTITY(1...
在ABP项目开发系列中,使用Poem作为例子,相关数据库表的Sql语句如下:
Poet:
CREATE TABLE [dbo].[Poet](
[PoetID] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](200) NULL,
[Description] [varchar](4000) NULL,
CONSTRAINT [PK_PEOT] PRIMARY KEY NONCLUSTERED
(
[PoetID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Poem:
CREATE TABLE [dbo].[Poem](
[PoemId] [int] IDENTITY(1,1) NOT NULL,
[PoetID] [int] NULL,
[Title] [nvarchar](1024) NULL,
[Content] [ntext] NULL,
[Comments] [ntext] NULL,
[Volumn] [nvarchar](20) NULL,
[Num] [nvarchar](20) NULL,
CONSTRAINT [PK_PEOM] PRIMARY KEY NONCLUSTERED
(
[PoemId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[Poem] WITH CHECK ADD CONSTRAINT [FK_Peom_Peot] FOREIGN KEY([PoetID])
REFERENCES [dbo].[Poet] ([PoetID])
GO
ALTER TABLE [dbo].[Poem] CHECK CONSTRAINT [FK_Peom_Peot]
GO
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
Category:
CREATE TABLE [dbo].[Category](
[CategoryName] [nvarchar](150) NULL,
[CategoryId] [int] IDENTITY(1,1) NOT NULL,
CONSTRAINT [PK_Category] PRIMARY KEY CLUSTERED
(
[CategoryId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
CategoryPoem:
CREATE TABLE [dbo].[CategoryPoem](
[CategoryPoemId] [int] IDENTITY(1,1) NOT NULL,
[CategoryId] [int] NOT NULL,
[PoemId] [int] NOT NULL,
CONSTRAINT [PK_CategoryPeom] PRIMARY KEY CLUSTERED
(
[CategoryPoemId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CategoryPoem] WITH CHECK ADD CONSTRAINT [FK_CategoryPeom_Category] FOREIGN KEY([CategoryId])
REFERENCES [dbo].[Category] ([CategoryId])
GO
ALTER TABLE [dbo].[CategoryPoem] CHECK CONSTRAINT [FK_CategoryPeom_Category]
GO
ALTER TABLE [dbo].[CategoryPoem] WITH CHECK ADD CONSTRAINT [FK_CategoryPeom_Peom] FOREIGN KEY([PoemId])
REFERENCES [dbo].[Poem] ([PoemId])
GO
ALTER TABLE [dbo].[CategoryPoem] CHECK CONSTRAINT [FK_CategoryPeom_Peom]
GO
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
PoemLine:
CREATE TABLE [dbo].[PoemLine](
[PoemLineId] [int] IDENTITY(1,1) NOT NULL,
[PoemId] [int] NOT NULL,
[LineContent] [nvarchar](4000) NULL,
[Order] [int] NULL,
CONSTRAINT [PK_PEOMLINE] PRIMARY KEY NONCLUSTERED
(
[PoemLineId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PoemLine] WITH CHECK ADD CONSTRAINT [FK_PeomLine_Peom] FOREIGN KEY([PoemId])
REFERENCES [dbo].[Poem] ([PoemId])
GO
ALTER TABLE [dbo].[PoemLine] CHECK CONSTRAINT [FK_PeomLine_Peom]
GO
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
文章来源: codeboy.blog.csdn.net,作者:愚公搬代码,版权归原作者所有,如需转载,请联系作者。
原文链接:codeboy.blog.csdn.net/article/details/108150587
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)