COMPREHENSIVE EXAM
◉ TRUNCATE Statement. Answer: Deletes all rows from a table.
◉ Primary Key. Answer: A _______ ___ is a constraint on a column, or
group of columns, used to identify a row. The ________ ____ is usually
the table's first column and appears on the left of table diagrams, but
the position is not significant to the database. A solid circle (●)
notates these in table diagrams.
MUST BE "Unique" and "Not NULL"
◉ Simple Primary Key. Answer: A key that consists of a SINGLE
column.
◉ Composite Key. Answer: A key that consists of multiple columns
and is denoted with parenthesis.
MUST BE Minimal, meaning only NECESSARY primary keys may be
involved. In it's minimal stage, if one of these keys is removed it then
becomes no longer unique.
,◉ Auto-Increment. Answer: Database users occasionally make the
following errors when inserting primary keys:
Inserting values for auto-increment primary keys.
Omitting values for primary keys that are not auto-increment
columns.
MySQL allows insertion of a specific value to an auto-increment
column. However, overriding auto-increment for a primary key is
usually a mistake.
◉ Foreign Key. Answer: Is a column, or group of columns, that refer
to a primary key. An empty circle (○) represents foreign keys in table
diagrams, and an arrow leads to the referenced primary key.
When a ________ _____ constraint is specified, the database rejects
insert, update, and delete statements that violate referential
integrity.
Referential integrity requires ________ ____ values must either be NULL
or match some value of the referenced primary key.
◉ RESTRICT. Answer: ________ rejects an insert, update, or delete that
violates referential integrity.
◉ CASCADE. Answer: Propagates primary key changes to foreign
keys.
, ◉ Constraint. Answer: A __________ is a rule that governs allowable
values in a database based on relational and business rules.
◉ UNIQUE (Constraint). Answer: The _______ constraint ensures that
values in a column, or group of columns, are NEVER REPEATED.
◉ CHECK (Constraint). Answer: The _______ constraint specifies an
expression on one or more columns of a table.
◉ Adding and Dropping Constraints. Answer: Constraints are added
and dropped with the ALTER TABLE TableName followed by an ADD,
DROP, or CHANGE clause.
◉ BETWEEN (Operator). Answer: The ________ operator provides an
alternative way to determine if a value is between two other values.
◉ LIKE (Operator). Answer: The _____ operator, when used in a
WHERE clause, matches text against a pattern using the two
wildcard characters % and _.
◉ ORDER BY (Clause). Answer: The _____ ___ clause orders selected
rows by one or more columns in ascending (alphabetic or
increasing) order. The DESC keyword with the ORDER BY clause
orders rows in descending order.