constraints Flashcards

1
Q

Restricts NULL value from being inserted into a column

A

NOT NULL

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

Verifies that all values in a field satisfy a condition

A

CHECK

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

Automatically assigns a default value if no value has been specified for the field

A

DEFAULT

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

Ensures unique values to be inserted into the field

A

UNIQUE

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

Indexes a field providing faster retrieval of records

A

INDEX

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

Uniquely identifies each record in a table

A

PRIMARY KEY

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

Ensures referential integrity for a record in another table

A

FOREIGN KEY

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

Create table with multiple fields as primary ke

A
CREATE TABLE Students ( 	 
    ID INT NOT NULL
    LastName VARCHAR(255)
    FirstName VARCHAR(255) NOT NULL,
    CONSTRAINT PK_Student
    PRIMARY KEY (ID, FirstName)
);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Set multiple columns as primary key

A

ALTER TABLE Students
ADD CONSTRAINT PK_Student
PRIMARY KEY (ID, FirstName);

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

Set a column as primary key

A

ALTER TABLE Students

ADD PRIMARY KEY (ID);

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

Create table with multiple fields as unique

A
CREATE TABLE Students ( 	 
    ID INT NOT NULL
    LastName VARCHAR(255)
    FirstName VARCHAR(255) NOT NULL
    CONSTRAINT PK_Student
    UNIQUE (ID, FirstName)
);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Create index

A
CREATE INDEX index_name 	 
ON table_name (column_1, column_2);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is Data Integrity?

A

Data Integrity is the assurance of accuracy and consistency of data over its entire life-cycle, and is a critical aspect to the design, implementation and usage of any system which stores, processes, or retrieves data. It also defines integrity constraints to enforce business rules on the data when it is entered into an application or a database.

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