ISA 345 EXAM 1 – CODE STUDY GUIDE
entities - Answers -gives the framework for the table
abstraction of a table (logical construct)
Like the picture modeling
attribute - Answers -discrete data element that describes an entity
- names are unique within the database model and meaningful
Popular types of attributes - Answers -- numeric (integer, smallint, decimal, number)
- string (char, varchar, varchar2)
- date (date)
naming conventions in class - Answers -Attribute types and the first letter of attribute
names in capital letters
If more than one word, words will be combined into one with first letter of each
capitalized
identifier - Answers -another word for primary key
can be an attribute or a collection of attributes
Oracle SQL developer uses P and PL to denote
Creating a table in SQL coding - Answers -CREATE TABLE <table-name>(
<column-list>
[<constraint-list>]
);
Where <column-list> lists attribute names and types
[<constraint-list>] lists optional external constraints
Example of a Table being made - Answers -CREATE TABLE FACULTY(
Age SMALLINT CONSTRAINT AgeNotNull NOT NULL,
Salary NUMBER(9,2),
CONSTRAINT AgeOver0 CHECK(Age >0)
Integrity constraints - Answers -define valid sets of values for each attribute
Constraints we learn about - Answers -PRIMARY KEY
UNIQUE
NOT NULL
, CHECK
FOREIGN KEY
inline constraints - Answers -defined after an attribute's type
CONSTRAINT <ConstraintName><Constraint-Spec>
EX: DeptNo SMALLINT CONSTRAINT DeptNoPK PRIMARY KEY
PRIMARY KEY constraint - Answers -specifies a set of col that are the primary key
Composite primary key - Answers -primary key combo from more than one column
Must be external constraint
external constraint - Answers -written after all attributes are written
CONSTRAINT <ConstraintName>
EX: CONSTRAINT AgeOverZero CHECK(Age>0)
Unique constraint - Answers -constrains a column so that no two of its values are equal
EX: SSN Number(10) CONSTRAINT SSNUnique UNIQUE
NOT NULL constraint - Answers -constrains a col so that it cannot have a missing/null
value
ALWAYS inline
EX: PersonName VARCHAR(12) CONSTRAINT NameNotNUll NOT NULL
CHECK constraint - Answers -define a set of values for one or more variables
EX: CONSTRAINT AgeOver0 CHECK(Age >0)
How to fix the issue of not being able to make a table because a table with the name
already exists - Answers -DROP TABLE
DROP TABLE form - Answers -DROP TABLE <table-name> [<constraint-list>];
Where [<constraint-list>] lists optional constraints
ALTER TABLE - Answers -allows a table to be changed, added to, or deleted from
ALTER TABLE
entities - Answers -gives the framework for the table
abstraction of a table (logical construct)
Like the picture modeling
attribute - Answers -discrete data element that describes an entity
- names are unique within the database model and meaningful
Popular types of attributes - Answers -- numeric (integer, smallint, decimal, number)
- string (char, varchar, varchar2)
- date (date)
naming conventions in class - Answers -Attribute types and the first letter of attribute
names in capital letters
If more than one word, words will be combined into one with first letter of each
capitalized
identifier - Answers -another word for primary key
can be an attribute or a collection of attributes
Oracle SQL developer uses P and PL to denote
Creating a table in SQL coding - Answers -CREATE TABLE <table-name>(
<column-list>
[<constraint-list>]
);
Where <column-list> lists attribute names and types
[<constraint-list>] lists optional external constraints
Example of a Table being made - Answers -CREATE TABLE FACULTY(
Age SMALLINT CONSTRAINT AgeNotNull NOT NULL,
Salary NUMBER(9,2),
CONSTRAINT AgeOver0 CHECK(Age >0)
Integrity constraints - Answers -define valid sets of values for each attribute
Constraints we learn about - Answers -PRIMARY KEY
UNIQUE
NOT NULL
, CHECK
FOREIGN KEY
inline constraints - Answers -defined after an attribute's type
CONSTRAINT <ConstraintName><Constraint-Spec>
EX: DeptNo SMALLINT CONSTRAINT DeptNoPK PRIMARY KEY
PRIMARY KEY constraint - Answers -specifies a set of col that are the primary key
Composite primary key - Answers -primary key combo from more than one column
Must be external constraint
external constraint - Answers -written after all attributes are written
CONSTRAINT <ConstraintName>
EX: CONSTRAINT AgeOverZero CHECK(Age>0)
Unique constraint - Answers -constrains a column so that no two of its values are equal
EX: SSN Number(10) CONSTRAINT SSNUnique UNIQUE
NOT NULL constraint - Answers -constrains a col so that it cannot have a missing/null
value
ALWAYS inline
EX: PersonName VARCHAR(12) CONSTRAINT NameNotNUll NOT NULL
CHECK constraint - Answers -define a set of values for one or more variables
EX: CONSTRAINT AgeOver0 CHECK(Age >0)
How to fix the issue of not being able to make a table because a table with the name
already exists - Answers -DROP TABLE
DROP TABLE form - Answers -DROP TABLE <table-name> [<constraint-list>];
Where [<constraint-list>] lists optional constraints
ALTER TABLE - Answers -allows a table to be changed, added to, or deleted from
ALTER TABLE