Understanding Database User Accounts and Schemas Flashcards

Explore essential concepts of database user accounts and schemas with these informative flashcards.

1
Q

What is a Windows user account?

A

A Windows user account or a login allows a user to log in to the system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is required to access a database in the system?

A

A user needs a database user account to work with the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How many database user accounts does a user need?

A

Users must have a database user account for each database they want to use.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the syntax to create a login account?

A

CREATE LOGIN login_name { WITH option_list1 | FROM {WINDOWS [ WITH option_list2 [,…] ] | CERTIFICATE certname | ASYMMETRIC KEY key_name }}

Example: CREATE LOGIN mary WITH PASSWORD = ‘you1know4it9’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the types of principals in a database schema?

A

A principal can be either an indivisible principal or a group principal.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does an indivisible principal represent?

A

An indivisible principal represents a single user, such as a login or Windows user account.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does a group principal represent?

A

A group principal can be a group of users, such as a role or a Windows group.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a significant benefit of separating database users from schemas?

A

One principal can own several schemas.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What happens when a database user is dropped?

A

Dropping a database user does not require the renaming of objects contained by that user’s schema.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the default schema in a database?

A

Each database has a default schema, which is used to resolve the names of objects that are referred to without their fully qualified names.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the three Transact-SQL schema-related statements?

A

CREATE SCHEMA, ALTER SCHEMA, DROP SCHEMA.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the syntax to create a schema?

A

CREATE SCHEMA my_schema AUTHORIZATION peter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the ALTER SCHEMA statement do?

A

The ALTER SCHEMA statement transfers an object between different schemas of the same database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the syntax for the ALTER SCHEMA statement?

A

ALTER SCHEMA schema_name TRANSFER object_name

Example: ALTER SCHEMA humanresources TRANSFER person.address

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you change the ownership of a schema?

A

Use the ALTER AUTHORIZATION statement to change the ownership of a schema.

Example: ALTER AUTHORIZATION ON SCHEMA ::my_schema TO mary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the DROP SCHEMA statement do?

A

The DROP SCHEMA statement removes a schema from the database.

17
Q

What is required for a DROP SCHEMA statement to execute successfully?

A

The schema must not contain any objects.

18
Q

What is the syntax to create a database user account?

A

CREATE USER user_name [FOR {LOGIN login | CERTIFICATE cert_name | ASYMMETRIC KEY key_name}] [ WITH DEFAULT_SCHEMA = schema_name]

Example: CREATE USER peter FOR LOGIN [NTB11901\pete]

19
Q

What does the ALTER USER statement do?

A

The ALTER USER statement modifies a database username, changes its default schema, or remaps a user to another login.

20
Q

What does the DROP USER statement do?

A

The DROP USER statement removes a user from the current database.