IS390 Ch 9: Designing the Database

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play

1/52

encourage image

There are no tags or description

Looks like no tags are added yet.

53 Terms

1
New cards

database (DB)

an integrated collection of stored data that is centrally managed and controlled

2
New cards

database management system (DBMS)

a system software component that manages and controls one or more databases

3
New cards

schema

a database component that contains descriptive information about the data stored i the physical data store (sometimes called metadata)

4
New cards

structured query language

the standard query language to access and update data in a relational DBMS

5
New cards

DBMS components

databse data


Database Data (left container)

  • Application domain data

  • Schema data


6
New cards

DBMS components

database management system


Database Management System (center container)

  • DBMS control logic

  • API SQL processor

  • Direct SQL processor

  • Administration interface


7
New cards

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)


8
New cards

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.


9
New cards

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

10
New cards

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


11
New cards

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)

12
New cards

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


13
New cards

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

14
New cards

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

15
New cards

DBA vs DA

knowt flashcard image
16
New cards

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

17
New cards

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

18
New cards

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


<p>What is a primary key in SQL?</p><ul><li><p>A type of index that is used to uniquely identify rows in a column and is almost exclusively used on integer columns.</p></li></ul><p>What is a foreign key?</p><ul><li><p>A type of index that is linked to a column in another table. That allows such indexes to “connect” with rows in another tabl</p></li></ul><p></p>
19
New cards

example partial display of a relational database table

knowt flashcard image
20
New cards

how an association between classes looks in a diagram


<p></p>
21
New cards

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

EXAMPLE


<p></p>
22
New cards

9 steps of designing relational databases

  • based on domain model class diagram


  1. 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


23
New cards

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.


24
New cards

creating RDBMS for RMO

classes, tables , keys examples in slides 22-24

25
New cards

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.


26
New cards

how are foreign keys added in tables

with italics in the attributes section of the row of its table

27
New cards

how are primary keys added in tables

with bold in the attributes section of the row of its table

28
New cards

tables examples slides 26-29



29
New cards

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).

30
New cards

referential integrity constraint

a constraint, stored in the schema, that the DBMS uses to automatically enforce referential integrity

31
New cards

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


32
New cards

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 –


33
New cards

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


<p>A table is in first normal form if every field contains only one value.</p><ul><li><p>Not multiple values in an attribute</p></li><li><p>Not varying number of columns</p></li></ul><p></p>
34
New cards

first normal form - solution

knowt flashcard image
35
New cards

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


36
New cards

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).


37
New cards

second normal form example and solution


<p></p>
38
New cards

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).


39
New cards

third normal form example and solution

knowt flashcard image
40
New cards

third normal form second solution


<p></p>
41
New cards

what does data type define

the storage format and allowable content of an attribute (field)

42
New cards

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

43
New cards

standard primitive data types table


<p></p>
44
New cards

3 types of distributed database architectures

decentralized

homogenous

heterogenous

45
New cards

decentralized database

database is stored at many locations but not requiring interconnectivity or synchronization

46
New cards

homoegenous distributed database + how it is accessed

is stored at mult locations w/all locations using the same DBMS, coordinated with a global schema


<p>is stored at mult locations w/all locations using the<strong> same DBMS, coordinated with a global schema</strong></p><p></p>
47
New cards

heteogeneous distributed database + how it is accessed

database is stored at mult kocations w diff dbms and may have local schemas

<p>database is stored at mult kocations w <strong>diff dbms and may have local schemas </strong></p>
48
New cards

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


49
New cards

horizontal partition (implementation approachs)

different rows are stored at different locations.

<p>different rows are stored at different locations.</p>
50
New cards

vertical partition (implementation approachs)

diff columns are stored at diff locations

combinations of replication horizontal and vertical in the example image


<p><strong>diff columns are stored at diff locations</strong></p><p>combinations of replication horizontal and vertical in the example image</p><p></p>
51
New cards

architecture for RMO example - replicated and partitioned database


<p></p>
52
New cards

transaction logging

(protecting the database)

a technique to record all updates including change, date, time, user

  • Helps to prevent fraud

  • Recovery mechanism for failures


53
New cards

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