SNHU DAD 220 TEST PAPER QUESTIONS AND SOLUTIONS
2025/2026 RATED A+
✔✔What does the WHERE command do? - ✔✔Is a command used to specify a
condition for a selecting row.
Ex:
SELECT Expression1, Expression2
FROM TableName,
WHERE Condition;
✔✔What is a primary key? - ✔✔A column or group there of to identify a row.
Usually the first column on the left or is indicated by a solid dot.
✔✔True or False: Can a primary key be UNIQUE or NOT NULL? - ✔✔True.
✔✔What are the two types of primary keys? - ✔✔Simple primary keys and Composite
primary keys.
✔✔What is a simple primary key? - ✔✔Consist of one single column.
Ex:
CREATE TABLE Employee (
ID SMALLINT UNSIGNED,
Name VARCHAR(60),
Salary DECIMAL(7,2),
PRIMARY KEY (ID)
);
✔✔What is the composite primary key? - ✔✔Consists of multiple different columns.
Usually denoted by parenthesis (ColumnA, ColumnB)
Ex:
CREATE TABLE Employee (
ID SMALLINT UNSIGNED,
Name VARCHAR(60),
Salary DECIMAL(7,2),
PRIMARY KEY (ID, Number)
);
✔✔What are the 3 rules that a composite primary key must follow? - ✔✔1. UNIQUE (No
values can be repeated)
2. NOT NULL (No column of a composite key can contain a null value)
, 3. Minimal (Primary keys are already unique, but once deleted the simple or composite
is no longer unique)
✔✔What is an auto-increment column? - ✔✔A numeric column automatically assigned
a number when the row is created.
Ex:
CREATE TABLE Employee (
ID SMALLINT UNSIGNED AUTO_INCREMENT,
Name VARCHAR(60),
Salary DECIMAL(7,2),
PRIMARY KEY (ID)
);
✔✔What is a foreign key? - ✔✔A column or group of columns that refer to a primary
key.
Ex:
CREATE TABLE Employee (
ID SMALLINT UNSIGNED,
Name VARCHAR(60),
Salary DECIMAL(7,2),
PRIMARY KEY (ID)
FOREIGN KEY (Salary) REFERENCES Department(Salary);
);
✔✔What is referential integrity? - ✔✔Requires foregin key values to be NULL or match
some value of the referenced primary key.
✔✔What is fully null? - ✔✔A foreign key, simple, or composite, in which all columns are
null.
✔✔What are the 4 ways the referential integrity can be violated? - ✔✔1. A primary Key
is updated.
2. A foreign key is updated.
3. A row containing a primary key is deleted.
4. A row containing a foreign key is inserted.
✔✔What are the 4 referential integrity actions? - ✔✔1. RESTRICT
2. SET NULL
3. SET DEFAULT
4. CASCADE
2025/2026 RATED A+
✔✔What does the WHERE command do? - ✔✔Is a command used to specify a
condition for a selecting row.
Ex:
SELECT Expression1, Expression2
FROM TableName,
WHERE Condition;
✔✔What is a primary key? - ✔✔A column or group there of to identify a row.
Usually the first column on the left or is indicated by a solid dot.
✔✔True or False: Can a primary key be UNIQUE or NOT NULL? - ✔✔True.
✔✔What are the two types of primary keys? - ✔✔Simple primary keys and Composite
primary keys.
✔✔What is a simple primary key? - ✔✔Consist of one single column.
Ex:
CREATE TABLE Employee (
ID SMALLINT UNSIGNED,
Name VARCHAR(60),
Salary DECIMAL(7,2),
PRIMARY KEY (ID)
);
✔✔What is the composite primary key? - ✔✔Consists of multiple different columns.
Usually denoted by parenthesis (ColumnA, ColumnB)
Ex:
CREATE TABLE Employee (
ID SMALLINT UNSIGNED,
Name VARCHAR(60),
Salary DECIMAL(7,2),
PRIMARY KEY (ID, Number)
);
✔✔What are the 3 rules that a composite primary key must follow? - ✔✔1. UNIQUE (No
values can be repeated)
2. NOT NULL (No column of a composite key can contain a null value)
, 3. Minimal (Primary keys are already unique, but once deleted the simple or composite
is no longer unique)
✔✔What is an auto-increment column? - ✔✔A numeric column automatically assigned
a number when the row is created.
Ex:
CREATE TABLE Employee (
ID SMALLINT UNSIGNED AUTO_INCREMENT,
Name VARCHAR(60),
Salary DECIMAL(7,2),
PRIMARY KEY (ID)
);
✔✔What is a foreign key? - ✔✔A column or group of columns that refer to a primary
key.
Ex:
CREATE TABLE Employee (
ID SMALLINT UNSIGNED,
Name VARCHAR(60),
Salary DECIMAL(7,2),
PRIMARY KEY (ID)
FOREIGN KEY (Salary) REFERENCES Department(Salary);
);
✔✔What is referential integrity? - ✔✔Requires foregin key values to be NULL or match
some value of the referenced primary key.
✔✔What is fully null? - ✔✔A foreign key, simple, or composite, in which all columns are
null.
✔✔What are the 4 ways the referential integrity can be violated? - ✔✔1. A primary Key
is updated.
2. A foreign key is updated.
3. A row containing a primary key is deleted.
4. A row containing a foreign key is inserted.
✔✔What are the 4 referential integrity actions? - ✔✔1. RESTRICT
2. SET NULL
3. SET DEFAULT
4. CASCADE