1/52
Looks like no tags are added yet.
database (DB)
an integrated collection of stored data that is centrally managed and controlled
database management system (DBMS)
a system software component that manages and controls one or more databases
schema
a database component that contains descriptive information about the data stored i the physical data store (sometimes called metadata)
structured query language
the standard query language to access and update data in a relational DBMS
DBMS components
databse data
Database Data (left container)
Application domain data
Schema data
DBMS components
database management system
Database Management System (center container)
DBMS control logic
API SQL processor
Direct SQL processor
Administration interface
DBMS components
external users and systems
External Users and Systems (right side)
Application program (interacts with the API SQL processor)
Direct query user (interacts with the Direct SQL processor)
Database administrator (interacts with the Administration interface)
how do all the DBMS components work together
DBMS control logic: The overarching logic within the DBMS that manages and controls access to the underlying database data (both application domain data and schema data).
API SQL processor: Handles SQL requests coming from external application programs.
Direct SQL processor: Processes SQL queries entered directly by a direct query user.
Administration interface: Provides the tools and access needed by a database administrator (DBA) to manage and maintain the database.
database schema
blueprint of a database that defines:
Structure: How data is grouped into tables and how those tables connect to each other.
Storage: Technical details on how the data is physically saved (such as data types, sizes, locations, and indexes).
Rules & Security: What values are allowed in the database and which users are permitted to view or edit the data.
Organization of individual stored data items into higher level groups, such as tables
Associations among tables or classes
Details of physical data store organization, including types, lengths, locations, and indexing of data items
Access and content controls, including allowable values for specific data items, value dependencies among multiple data items, and lists of users allowed to read or update data items
characteristics of a DBMS
Simultaneous access by many users and many applications
Direct access to data with a data interface
Uniform and consistent access
Integration and distribution of data across multiple servers
technology architecture
single desktop
shared database
large database
very large database
Single desktop – single copy of database
Shared database – residing on local LAN
Large database – multiple servers within a single data farm
Very large database – multiple servers across multiple data farms (global)
How does database design integrate within the project plan?
waterfall development vs iterative development
when does it occur?
Water-fall development – design and implement database first
Iterative development – database is foundational, early iterations need to focus on data and key portions of the database
Important to consider database impacts of all subsystems
Data administrator (DA)
3 Ds responsibilities
person in charge of structure and integrity of the data
Data standards – naming, definition, data typing
Data use – ownership, accessibility, confidentiality
Data quality – validation rules, completeness, currency
Database Administrator (DBA)
4 responsibilities (MPMB)
person in charge of safety and the operation of the database
Manage multiple DBMS environment
Protect the database and data – authentication
Maintain high-performance level
Backup data and define recovery procedures
DBA vs DA

Relational database management system (RDBMS)
table
row
attribute
attribute value
a DBMS that organizes data in tables (relations)
Table -- a two-dimensional data structure of columns and rows
Row -- one horizontal group of data attribute values
Attribute -- one vertical group of data attribute values
column is One specific detail or property
Attribute value -- the value held in a single table cell
key
candidate key
primary key
foreign key
Key – an attribute or set of attributes, the values of which occur only once in all the rows of the table
Candidate Key – an attribute or set of attributes that could serve as the primary key
Primary key – the key chosen by a database designer to represent relationships among rows in different tables
Foreign key – an attribute that duplicates the primary key of a different (or foreign) table
primary key vs foreign key
What is a primary key in SQL?
A type of index that is used to uniquely identify rows in a column and is almost exclusively used on integer columns.
What is a foreign key?
A type of index that is linked to a column in another table. That allows such indexes to “connect” with rows in another tabl

example partial display of a relational database table

how an association between classes looks in a diagram

an association between rows in two tables (key and foreign key)
EXAMPLE

9 steps of designing relational databases
based on domain model class diagram
Create a table for each class
2. Choose a primary key for each table (invent one, if necessary)
3. Add foreign keys to represent one-to-many associations
4. Create new tables to represent many-to-many associations
5. Represent classification hierarchies
6. Define referential integrity constraints
7. Evaluate schema quality and make necessary improvements
8. Choose appropriate data types
9. Incorporate integrity and security controls
steps of designing relational databases SIMPLIFIED
Build tables & keys: Turn every class into a table and assign each a unique primary key.
Connect relationships: Link one-to-many tables with foreign keys, build bridge tables for many-to-many links, and structure parent-child hierarchies.
Enforce links: Set referential integrity rules so table connections stay valid and don't break.
Refine & format: Clean up the design (normalization), pick data types (like text or numbers), and add security permissions.
creating RDBMS for RMO
classes, tables , keys examples in slides 22-24
representing associations
one to many
many to many - w/ and w/o an association class
One-to-Many (1-to-M): Copy the primary key from the "1" table and paste it into the "many" table as a foreign key to link them (e.g., putting CustomerID into the Order table).
Many-to-Many WITH an Association Class: You already have a middle table (like PromoOffering between Promotion and ProductItem); just add both outer tables' primary keys into it as foreign keys to form its primary key.
Many-to-Many WITHOUT an Association Class: Because no middle table exists yet, create a brand-new bridge table and put both outer tables' primary keys inside it to connect them (like AccessoryPackageContents linking AccessoryPackage and ProductItem)\
One-to-Many – Add primary key attribute of the “one” class to the “many” class as a foreign key
Many-to-Many –
With an Association Class – Add primary keys of endpoint classes as foreign keys and as candidate keys. May also become primary key
Without an Association Class – Create new table. Add primary keys of endpoint classes as foreign keys and as candidate keys.
how are foreign keys added in tables
with italics in the attributes section of the row of its table
how are primary keys added in tables
with bold in the attributes section of the row of its table
tables examples slides 26-29
referential integrity
a consistent state among foreign key and primary key values
a database rule ensuring that relationships between tables stay valid and consistent—meaning a foreign key value must always point to an existing primary key value (or be NULL).
referential integrity constraint
a constraint, stored in the schema, that the DBMS uses to automatically enforce referential integrity
A normalized relational database schema has these features (3)
Flexibility or ease of implementing future data model changes
Lack of redundant data
Protects against insertion, deletion and update anomolies
normalization and its 3 normal forms
a formal technique for evaluating and improving the quality of a relational database schema
First Normal Form –
Second Normal Form –
Third Normal Form –
first normal form
A table is in first normal form if every field contains only one value.
Not multiple values in an attribute
Not varying number of columns

first normal form - solution

functional dependency
example, how is it written, and how is it stated
A relationship between attributes such that the values in the first attribute (or set) always determine the values in the second attribute (or set)
Attribute B is functionally dependent on attribute A if for each value of attribute A there is only one corresponding value of attribute B.
Written as FD: A → B
Also stated as A functionally determines B

second normal form
in what situation does this arise?
A table is in Second Normal Form if it is First Normal Form and each non-key attribute is only functionally dependent on the entire primary key.
This situation only arises with tables that have multiple attribute keys
2NF (No half-related items)
Problem: When a table has a two-part ID (like Promo ID + Product ID), some details only care about one part of that ID (a product's Regular Price only cares about the Product ID, not the promo).
Fix: Move that detail to the table where it actually belongs (the Product table).
second normal form example and solution

third normal form
A table is in Third Normal Form if it is in 2NF and NO non-key attribute (or set) is functionally dependent on any other non-key attribute (or set)
In other words, no FDs among any non-key attributes
3NF (No middlemen)
Problem: Column A tells you Column B, and Column B tells you Column C (e.g., Customer -> Credit Category -> Credit Rate). Or, a column is just a math total of other columns (like Total Price = Tax + Shipping).
Fix: Delete calculated totals, and move the "middleman" facts into their own separate lookup table (e.g., a CreditRule table).
third normal form example and solution

third normal form second solution

what does data type define
the storage format and allowable content of an attribute (field)
primitive vs complex data types
Primitive data types – data types supported directly by the DBMS
Complex data types – combinations or compositions of primitive data types. User defined
standard primitive data types table

3 types of distributed database architectures
decentralized
homogenous
heterogenous
decentralized database
database is stored at many locations but not requiring interconnectivity or synchronization
homoegenous distributed database + how it is accessed
is stored at mult locations w/all locations using the same DBMS, coordinated with a global schema

heteogeneous distributed database + how it is accessed
database is stored at mult kocations w diff dbms and may have local schemas

data replication and synchronization (implementation approaches)
Data replication – each location has its own copy
Synchronization – updating every copy with changes made to every other copy
horizontal partition (implementation approachs)
different rows are stored at different locations.

vertical partition (implementation approachs)
diff columns are stored at diff locations
combinations of replication horizontal and vertical in the example image

architecture for RMO example - replicated and partitioned database

transaction logging
(protecting the database)
a technique to record all updates including change, date, time, user
Helps to prevent fraud
Recovery mechanism for failures
Concurrency and update controls (protecting the database)
Transaction
Database lock
Shared or read lock
Exclusive or write lock
Transaction – a piece of work with several steps, either all must complete or none must be accepted
Database lock – technique to apply exclusive control to a portion of the database to one user at a time
Shared or read lock – a lock where multiple transactions (users) may read the data
Exclusive or write lock – a lock where only one transaction (user) may access the locked portion of the database