click below
click below
Normal Size Small Size show me how
Data Types
mcp 70-441 Designing Databases (Microsoft SQL Server 2005)
Question | Answer |
---|---|
name the types of primary keys | - natural key- surrogate key |
Describe the natural primary key | A candidate key that naturally has a logical relationship with the rest of the attributes in the row |
What are good examples for using CLR User | Geospatial dataCustom date, time, currency & extended numeric dataComplex data (structures such as arrays)custom encoded or encrypted data |
What are the Steps for creating a CLR User-Defined Data type | 1. Code and build the assembly that defines the CLR user-defined data type using a language that supports the .NET Framework2. Register assemply in SQL Server (t-sql)3. create CLR user-defined data type within the database (t-sql) |
How can you enforce domain integrity | - data type of the column- nullability- dml trigger- fk constraint pointing to parent table- check constraint |
What type of constraint is preferred | check constraint syntax is preferred |
what is the syntax for creating a check constraint | ALTER TABLE... MyTablewith CHECKADD CONSTRAINT myConstraintCHECK(logical expression goes here) |
what are the Con's to CHECK CONSTRAINTS? | - they can reference columns within the table- they cannot call subqueries directly |
design entities consist of: | - define the entities- entity integrity- define referential integrity |
What is the basic measurement for data in SQL Server? | an 8 KB page |
What are the limits to the data types sql server | 8060 bytes per ro2 billion tables per database1024 columns per tablerows & size in a table is virtually unlimited8060 per row, with (varchar,nvarchar, varbinary, varbinary data types can fall inti overflow) |
What should you consider when you use a computed fields | - extra space taken up by the computed field- How frequently is it queried?- will it be a part of the result set or the SQRG or both?- what will be the density / selectivity with the index?- how frequently the data updated? |
What are MORE considerations for computed fields? | - the expression is deterministic and precise- it can't evaluate image, nText or text data type- all functions referenced by the computed field have the same owner as the table.- a number of SET operations have been met |
What are the Pro's for Natural Keys | - they already exist- Indexes defined on them will be used by both user searches and join operations to speed up performance |
What are the con's for Natural keys | - They might change if your business requirements change- Compound or wide key can dramatically ... |
Why would a surrogate key be beneficial? | - it acts as an efficient index- it's never seen by the user |
what are the con's of having a surrogate key | a new unnatural column to your entity takes up additional space |
what ways can you implement a primary key(or the type of pk)? | - Using a primary key constraint- unique constraint- unique index- insert & update CMLtrigger checking unique-ness(typically use a primary key constraint) |
what is the constraint syntax | ALTER TABLE .... myTableADD CONSTRAINT myConstraintNamePRIMARY KEY | UNIQUE [CLUSTERED| NONCLUSTERED\ (mycolumn)[WITH (index_options)] |