Home > Database > Mysql Tutorial > 对于PowerDesigner中设计表自动生成Sql的分析

对于PowerDesigner中设计表自动生成Sql的分析

WBOY
Release: 2016-06-07 15:29:19
Original
1399 people have browsed it

if exists (select 1 from sysobjects where id = object_id('DWLX') and type = 'U') drop table DWLXgo/*==============================================================*//* Table: DWLX *//*========================================================

if exists (select 1
            from  sysobjects
           where  id = object_id('DWLX')
            and   type = 'U')
   drop table DWLX
go

/*==============================================================*/
/* Table: DWLX                                                */
/*==============================================================*/
create table DWLX (
   DWLX_NM            varchar(36)          not null,
   DWLX_LXBH          varchar(6)           not null,
   DWLX_LXMC          varchar(64)          not null,
   DWLX_LEVEL         int                  not null,
   DWLX_FJNM          varchar(36)          not null,
   DWLX_MX            char(1)              not null,
   constraint PK_DWLX primary key nonclustered (DWLX_NM)
)
go
Copy after login

分析constraint PK_DWLX primary key nonclustered (DWLX_NM)这句话:

对表DWLX建立主键约束,主键约束的名字是:PK_DWLX ,主键列是:DWLX_NM。

PRIMARY KEY 约束默认为 CLUSTERED;UNIQUE 约束默认为 NONCLUSTERED。此处指明该表为nonclustered索引(即非聚集索引)。

小注:

1、Sql Server判断某个表是否存在:点击打开链接。

2、SQL Server中clustered与nonclustered的区别 :点击打开链接。

3、GO的意思是本语句块结束的意思,一遇到GO就直接提交到存储引擎。

GO (Transact-SQL)官方文档:点击打开链接

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template