Quiz 2 Flashcards
Physical Modeling Purpose
Translating the logical description of data into the technical specifications for storing and retrieving data
Physical Modeling Goal
Creating a design for storing data that will provide adequate performance and insuring database integrity, security and recoverability
Field
Smallest unit of data in a database
Field design
choose data type; coding, compression, and encryption; controlling data integrity
Four objectives when choosing data types
represent all possible values, improve data integrity, support all data manipulations, minimize storage space
Numeric data types
INT, SMALLINT, DECIMAL, NUMERIC(precision,scale)
Approximate numeric
FLOAT, REAL, DOUBLE
Data and Date time
DATE, TIME, DATETIME, TIMESTAMP, YEAR
String data
CHAR, VARCHAR(length), BINARY, VARBINARY, BLOB, TEXT, ENUM, SET
Integrity controls
data type, range control, default values, null value control, referential integrity
Range Control
data integrity constraint which indicates the upper and lower bounds for the field.
Default values
where one specifies the value that the field will take if no data has been entered.
Null value control
allows one to specify whether null values are allowed or not in the field.
Referential integrity
ensures that any value entered into a foreign key must have a corresponding value in the primary key of the related table. This ensures that there are no misplaced values in the foreign key.
Denormalization
Transforming normalizedrelations into unnormalizedphysical record specifications
Benefits of denormalization
Can improve performance (speed) by reducing the number of table lookups (i.e., reduce number of necessary join queries)
Costs of denormalization
wasted storage space, data integrity/consistency threats
Situations where we would denormalize
two entities with a one-to-one relationship and high access frequency between them;
associative entity with nonkey attributes. If there is a high frequency of join operations between the entities, it might be more efficient to combine the associative entity with one of the other entities;
reference data. If we have a 1:M relationship and the entity on
the one side does not participate in any other relationships
Horizontal partitioning
Distributing the rows of a table into several separate files; Useful for situations where different users need access to different row
Vertical partitioning
Distributing the columns of a table into several separate files; Useful for situations where different users need access to different columns; The primary key must be repeated in each file
Advantages of partitioning
Efficiency, local optimization, security, recovery and uptime, load balancing
Disadvantages of partitioning
Inconsistent access speed, additional complexity for the programmer, extra space or update time
Many points about data replication
Improves performance by allowing multiple users to access the same data at the same time with minimum contention
sacrifices data integrity due to data duplication
best for data that is not updated often
sequential file organization
Records are stored sequentially according to a primary key value
Indexed file organization
Records are stored sequentially or nonsequentially, and an index is created that allows the application software to locate individual records.
Hashed file organization
In a hashed file organization, the address of each record is determined using a hashing algorithm.
SQL
Structured Query Language, developed by IBM
DDL
Data definition language. Commands that define a database, including creating, altering, and dropping tables and establishing constraints
DML
Data Manipulation Language. Commands that maintain and query a database
DCL
Data Control Language. Commands that control a database, including administering privileges and committing data
DDL Commands
Create, Alter, Drop, Rename
DML Commands
Select, Update, Insert, Delete
DCL Commands
Grant, Revoke
DDL is used for
physical design and maintenance
DML is used for
implementation and maintenance
DCL is used for
implementation and maintenance
T/F SQL statements are case sensitive
FALSE
T/F SQL statements can be on more than one line
TRUE
Each SQL statement ends in a
semicolon