SQL Server 自动为primary key约束的列建立一

题目

SQL Server 自动为primary key约束的列建立一个索引。

参考答案和解析
正确答案:正确
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

使用SQL语言创建一个表,要限定某列的值具有唯一性,可以使用()约束

A. PRIMARY KEY

B. CHECK

C. UNIQUE

D. FOREIGN KEY


正确答案:AC

第2题:

SQL语言中实现候选码约束的语句是(24)。

A.用Candidate Key指定

B.用Primary Key指定

C.用UNIQUE NOT NULL约束指定

D.用UNIQUE约束指定


正确答案:C
解析:标准SQL定义了主码、外码约束,并没有直接定义候选码,候选码取值不能为空和不取重复值的约束可以通过UNIQUENOTNULL来实现。

第3题:

在SQL中,primary key为 约束的关键字,foreign key为 __________约束的关键字。


参考答案主码 外码

第4题:

在SQL Server 2000语句命令中,指定该列为该表的唯一标识行列的选项是()。

  • A、DEFAULT
  • B、IDENTITY
  • C、ROWGUIDCOL
  • D、PRIMARY KEY

正确答案:C

第5题:

通常情况,SQL Server 2005主要支持PRIMARY约束、UNIQUE约束、CHECK约束、DEFAULT约束、FOREIGN约束。( )在定义列时,它可以为表中的指定列提供默认值。

A.FOREIGN约束

B.DEFAULT约束

C.UNIQUE约束

D.CHECK


正确答案:B


第6题:

PRIMARY KEY约束和NULL约束不能同时定义在相同的列上。()


正确答案:对

第7题:

You are the administrator of SQL server 2000 computer. The server contains a database named MedicalRecords. Users access medical records by using the PatientID field. This field is the clustered primary key for the Patients table. When users try to access medical records, the database responds slowly. You examine the database options as shown in the exhibit.

You want to accelerate query response time and minimize administrative overhead. How should you reconfigure the database?

A.Create a SQL Server Agent job to execute the UPDATE STATISTICS statement, and schedule the job to run weekly.

B.Select the Auto Update Statistics check box.

C.Run the database maintenance plan wizard, and accept the default settings.

D.Rebuild the primary key as a nonclustered primary key.

E.Clear the Auto Create Statistics check box.


正确答案:B
解析:Explanation:TheAutoUpdateStatisticsoptionisselectedbydefaultbutintheExhibitithasbeendisabled.Apparentlythestatisticsareout-of-dateandthequeriesarerunningslowly.TheAutoUpdateStatisticsoptionshouldbeenabledtoincreaseperformanceandminimizeadministrativeoverhead.Note:SQLServerkeepsstatisticsaboutthedistributionofthekeyvaluesineachindexandusesthesestatisticstodeterminewhichindexwouldbethebestindextouseforaparticularqueryprocess.Asthedatainacolumnchanges,indexandcolumnstatisticscanbecomeout-of-date.Thiscanhinderthequeryoptimizer’sabilitytomakeoptimaldecisionsonhowtoprocessaquery.Asaresultqueryperformancewilldeteriorate.Whenstatisticsbecomeout-of-datetheycanbeupdatedautomaticallyiftheAutoUpdateStatisticscheckboxonthetablepropertydialogboxischecked.IncorrectAnswers:A:Itwouldrequiresomeadministrativeefforttosetupjobthatupdatethestatistics.JustselectingtheAutoUpdateStatisticscheckisabettersolution.C:TheDatabaseMaintenancePlanWizardcannotbeusedtorecreatethestatistics,whicharethemainproblematthemoment.Note:TheDatabaseMaintenancePlanWizardcanbeusedtosetupthecoremaintenancetasksnecessarytoensurethatadatabaseperformswell,isregularlybackedup,andischeckedforinconsistencies.TheDatabaseMaintenancePlanWizardcreatesaSQLServer2000jobthatperformsthesemaintenancetasksautomaticallyatscheduledintervalsandcanbeusedtoreorganizethedataonthedataandindexpagesbyrebuildingindexeswithanewfillfactor;compressdatafilesbyremovingemptydatabasepages;updateindexstatisticstoensurethequeryoptimizerhasup-todateinformationaboutthedistributionofdatavaluesinthetables;perform.internalconsistencychecksofthedataanddatapageswithinthedatabasetoensurethatasystemorsoftwareproblemhasnotdamageddata;backupthedatabaseandtransactionlogfiles;andtosetuplogshipping.D:Lookingattheexhibitweseethatthisisastatisticsproblem,notaindexproblem.Note:Anonclusteredindexissimilartoanindexinatextbook.Withthistypeofindex,thedataisstoredinoneplaceandtheindexinanother.Theseindexes,however,pointtothestoragelocationofthedata.Nonclusteredindexesshouldbeusedoncolumnsthatcontainalargenumberofdistinctvalues;forqueriesthatdonotreturnlargeresultsets;andforcolumnsthatarefrequentlyinvolvedinsearchconditionsofaquerythatreturnexactmatches.Aclusteredindex,ontheotherhand,determinesthephysicalorderofdatainatable.ThePRIMARYKEYindexautomaticallycreatesaclusteredindexasitisusedtoidentifyarowunlessanonclusteredindexisspecified.E:WhensettheAutoCreateStatisticscheckboxischecked,statisticsareautomaticallycreatedoncolumnsthatareusedinapredicate.AddingstatisticsimprovesqueryperformancebecausetheSQLServerqueryoptimizercanbetterdeterminehowtoevaluateaquery.Ifthestatisticsarenotused,SQLServerautomaticallydeletesthem.Whenthischeckboxiscleared,statisticsarenotautomaticallycreated.

第8题:

用SQL语句创建表,使用语句 CREATE TABLE 。对列的约束主要有NOT NULL ,UNIQUE,PRIMARY KEY ,FOREIGN KEY 等。定义表的删除与更新操作的完整性约束,主要有四种模式:NO ACTION ,CASCADE ,SET NULL ,SET DEFAULT 。检查列的取值范围可以用 CHECK 约束。设定列的默认取值,可以用DEFAULT 短语。 ()


参考答案正确

第9题:

利用SQL语句的定义功能,建立一个“班级”表文件,其中为“ 班级号” 建立主索引,

“班级名”的默认值为“计算机”,语句格式为:

CREATE TABLE学生(;

学号C(5)PRIMARY KEY;

班级名C(16)__________计算机”).


正确答案:
DEFAULT
【解析】在Visual FoxPro中可以通过SQL的CREATE TABLE命令建立表。其中,通过DEFAULT短语可以为指定字段建立默认值。

第10题:

您需要确保“座位标识”列中的每个值唯一或为Null。应该对“座位标识”列定义哪个约束条件?()

  • A、CHECK
  • B、UNIQUE
  • C、NOT NULL
  • D、PRIMARY KEY

正确答案:A

更多相关问题