问题描述
- 这个sql语句什么意思?
-
CREATE TABLE [dbo].users NOT NULL,
[hashed_password] varchar NOT NULL,
[salt] varchar NOT NULL,
[lv] [smallint] NOT NULL,
[created_on] [datetime] NOT NULL DEFAULT(GETDATE()),
[created_platform] [smallint] NOT NULL,
[created_ip] varchar NOT NULL,
[last_login_on] [datetime] NULL,
[last_login_platform] [smallint] NULL,
[last_login_ip] varchar NULL,
[login_on] [datetime] NULL,
[login_platform] [smallint] NULL,
[login_ip] varchar NULL,
[status] [tinyint] NOT NULL,
CONSTRAINT [PK_users] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GOCONSTRAINT [PK_users] PRIMARY KEY CLUSTERED
(
[id] 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
这些不是很明白啊
解决方案
CREATE TABLE 创建了一个表,PK_users这里定义了一个主键,并且设置了排序规则和建立了索引。
解决方案二:
从字面上看
CREATE TABLE [dbo].users NOT NULL, 用户表
[hashed_password] varchar NOT NULL, 密码的Hash
[salt] varchar NOT NULL, Hash的Salt
[lv] [smallint] NOT NULL, 等级
[created_on] [datetime] NOT NULL DEFAULT(GETDATE()), 创建时间
[created_platform] [smallint] NOT NULL, 创建的平台
[created_ip] varchar NOT NULL, 创建的ip
[last_login_on] [datetime] NULL, 上次登录时间
[last_login_platform] [smallint] NULL, 上次登录平台
[last_login_ip] varchar NULL, 上次登录ip
[login_on] [datetime] NULL, 登录时间
[login_platform] [smallint] NULL, 登录平台
[login_ip] varchar NULL, 登录ip
[status] [tinyint] NOT NULL, 状态
解决方案三:
这其实就是个创建数据库表的语句
解决方案四:
CONSTRAINT [PK_users] PRIMARY KEY CLUSTERED
(
[id] 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
字段我知道,就是这些不是很懂,第一次接触啊
解决方案五:
这个你直接去查联机丛书比较好。如果你运行的SSMS,直接按F1出来的帮助就可以了。你可以直接搜索不懂的部分。
解决方案六:
ON [PRIMARY] 表示这个表建立在 PRIMARY主数据组
PAD_INDEX = OFF,
STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON, 允许行锁
ALLOW_PAGE_LOCKS = ON 允许页锁
具体的介绍在这里
解决方案七:
http://msdn.microsoft.com/zh-cn/library/ms188783.aspx
解决方案八:
DML = Data Manipulation Language
DDL = Data Definition Language
猜猜这个是哪个?