CREATE TABLE [dbo].[tStudent]
(
[cID] [uniqueidentifier] NOT NULL CONSTRAINT [DF_tStudent_cID] DEFAULT (newid()),
[cCreateTime] [datetime] NOT NULL CONSTRAINT [DF_tStudent_cCreateTime] DEFAULT (getdate()),
[cUpdateTime] [datetime] NOT NULL CONSTRAINT [DF_tStudent_cUpdateTime] DEFAULT (getdate()),
......
) ON [PRIMARY] ====》 这里的ON [PRIMARY]是什么意思? 怎么理解?
ON [PRIMARY] specifies which filegroup the table and the index for the primary key is placed on. PRIMARY is the default filegroup for a database. And for many databases the only filegroups.
For a large database, with dseveral hundreds GB or even more in size, you may want to define multiple filegroups to spread the load over different disks and controllers. In a simple development environment, there is no need for more than a single data file and a single filegroup. (Unless you work with FILESTREAM.)
You can consider ON [PRIMARY] to be white noise. And if you compose your scripts manually, you don't need to include it. SSMS generates this code, since it generates a script with settings and attributes for a table or an index, no matter it's the default or not.
。。。。好吧,我着实看不懂
看来翻译,是不是这个ON [PRIMARY]在通常情况下是ssms默认的?
@奇妙能力:
两个意见:
1、这个目前对你没用。
2、多看书。《SQL Server 从入门到精通》买一本是必须的。
@爱编程的大叔: 恩,大叔教育的是。
@奇妙能力: 趁年轻,学英语,不要等十年后后悔。
菜鸟,数据库可以有多个文件组,每个文件组里面又可以有多个文件,比如ON [PRIMARY] 里面 PRIMARY就是一个默认的文件组,
你不修改的情况下,它默认有2个文件,一个mdf,一个ldf文件;(不同的文件组物理位置可以不同,可以放在不同的磁盘里面,提高IO速度)
你提问中那句的意思就是在文件组PRIMARY 上面建立一个表;