Tables and Schemas Flashcards
How many databases does a SQL Server table belong to?
Just 1
SQL Server 70-461 08-01
What is meant by base tables?
Based tables hold the core data and are permanent in the sense that if SQL Server is shut down and restarted the based tables contents and definitions would remain.
SQL Server 70-461 08-01
What are two ways you can create a table?
- CREATE TABLE statement
- SELECT INTO statement
SQL Server 70-461 08-01
What is a schema?
A container that holds tables, views, procedures and other database objects.
SQL Server 70-461 08-01
What are two benefits of schemas?
- They allow you to group together objects in a way that makes sense for you and your organization
- You can set permissions at the schema level
SQL Server 70-461 08-01
How many schemas can a particular table belong to?
- Only one. You may have copies of the same table in multiple schemas but you couldn’t update table1 in schema ABC and expect the changes to flow to table1 schema xyz.
- Schema ABC is part of table1’s name and makes it unique to that schema.
SQL Server 70-461 08-01
If you don’t supply a database schema name, what is the default?
The database user name’s default schema
SQL Server 70-461 08-01
Can 2 objects within the same schema have the same name?
For example,
View=Test1
Table=Test1
No. Objects within a schema must have unique names, even if they are different types of objects.
SQL Server 70-461 08-01
How many owners does a schema have?
- Just one authorized database user.
- The schema owner can grant permissions to other users regarding objects in that schema
SQL Server 70-461 08-01
Should you use ROWVERSION OR TIMESTAMP?
ROWVERSION
SQL Server 70-461 08-01
How can you specify whether a column allows nulls?
- By putting NULL or NOT NULL after the columns data type. Null meaning Null’s are allowed.
- Example: categoryname NVARCHAR(15) NOT NULL
SQL Server 70-461 08-01
What two things can you specify when using the identity property?
- Seed=the value to begin with
- Increment=the amount to increase each new sequence number by
- Example: categoryid INT IDENTITY(1,1) NOT NULL
SQL Server 70-461 08-01
What does it mean to make a computed column persisted?
SQL Server will store the computed values with the table’s data and not compute them on the fly.
SQL Server 70-461 08-01
What type of functions can’t be used as part of the computed column expression if the column is persisted?
- Functions that are not deterministic
-
Example:
GETDATE()
CURRENT_TIMESTAMP
SQL Server 70-461 08-01
What does table compression do?
It compresses data in a table, in addition to the indexes, to get more efficient storage.
SQL Server 70-461 08-01