Table Components Flashcards

1
Q

What are some characteristics of a table?

A

It must contain at least one column, but it can contain zero rows.

Each column has to have a defined data type.

Columns can be set to allow or prevent null values.

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

What is a primary Key?

A

The Primary Key is a column or set of columns that makes a record unique in a table.

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

What is a Foreign Key?

A

A Foreign Key references the primary key in another table

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

Can a table have multiple Foreign Keys?

A

Yes!

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

Do the values need to be unique in a foreign key?

A

no

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

Do the values need to be unique in a primary key?

A

Yes

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

What is an Identity Column?

A

A numeric column that automatically increments when a new record is added to a table.

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

What is a NULL value?

A

An undefined value (not a blank value). Like a question that hasn’t been answered.

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

What is an exact numeric?

A

Its a data type like a bit, int, decimal, numeric, or money that stores numbers of various precision

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

What is a bit?

A

Can only can values like 1 or 0

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

What is an int?

A

Can only contain whole numbers (can be negative)

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

what is a decimal (p,s)

A

Can contain whole or decimal numbers. The p parameter specifies the total number of digits that the number can hold, and the s parameter specifies the number of digits to the right of the decimal point (scale).

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

How many decimal places can the decimal (p,s) go?

A

38

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

How many decimal places can the money numeric go?

A

4 decimal places

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

What is an approximate numeric?

A

Float and Real are approximate numerics. They are used when the precision of a number may exceed 38 places. They may not return an exact value.

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

What is the difference between float and real?

A

Real has a smaller range than float.

17
Q

What is datetime2

A

Stores precise date and time

18
Q

What is char (n)?

A

Stores fixed length character data like zip codes. Includes trailing spaces

19
Q

What is varchar (n)

A

It stores character data as variable lengths.

20
Q

What is varchar(max)

A

It stores large amounts of variable character data. Good for something like an essay.

21
Q

What is nchar(n)?

A

It stores fixed length foreign character data. Like chinese characters.

22
Q

What is nvarchar(n)?

A

It stores variable foreign character data lengths.

23
Q

What is nvarchar(max)?

A

It stores large amounts of variable character data.

24
Q

What is binary(n)?

A

Stores encrypted fixed-width data up to 8,000 bytes. The ‘n’ tells you how long. If the data is shorter than (n) length then it will be padded with zeros.

25
Q

What is the ‘n’ in varchar(n)?

A

The maximum number of bytes that can be stored.

26
Q

What is ‘max’ in varchar(max)?

A

It indicates that the column can store up to 2GB of data

27
Q

what is varbinary(n)?

A

Its for binary data used to store encrypted information like passwords that may vary in length. It stores up to 4,000 bytes.

28
Q

What is a byte?

A

Bytes are used to encode and store data in computer memory and storage devices. A byte consists of 8 bits. A bit is the smallest unit of data in a computer, representing a binary value of either 0 or 1.

29
Q

What is varbinary(max)?

A

Its for binary data used to store encrypted information. It stores character data up to 2GB.

30
Q

What are some alphanumeric data types?

A

char(n), varchar(n), varchar(max), text

31
Q

What is implicit conversion?

A

When SQL servers can convert the datatype automatically.

32
Q

What is explicit conversion?

A

When a CAST or CONVERT function must be used to convert the datatype.

33
Q
A