Entity Hierarchies, Keys, and SQL Query Techniques in Database Design

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/46

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

47 Terms

1
New cards

specialization hierarchy

Entity supertypes and subtypes are organized, which depicts the arrangement of higher-level entity supertypes and lower-level entity subtypes

2
New cards

Inheritance

-enables an entity subtype to inherit attributes and relationships of the supertype−

-All entity subtypes inherit their primary key attribute from their supertype

3
New cards

Primary Key

attribute(s) chosen to uniquely identify an entity, supports entity integrity

4
New cards

Composite Key

primary key made of more than one attribute. Useful for M:N relationships or weak entities

5
New cards

Disjoint subtypes

-contain a unique subset of the supertype entity set

6
New cards

Candidate Key

an attribute that could be the primary key (unique, but not chosen).

7
New cards

completeness constraint:

specifies whether each supertype occurrence must also be a member of at least one subtype

8
New cards

Partial completeness

that not every supertype occurrence is a member of a subtype

9
New cards

Total completeness

that every supertype occurrence must be a member of at least one subtypes

10
New cards

Specialization

-the top-down process of identifying lower-level, more specific entity subtypes from a higher-level entity supertype

− is based on grouping unique characteristics and relationships of the subtypes

11
New cards

Generalization

the bottom-up process of identifying a higher-level, more generic entity supertype from lower-level entity subtypes

− Generalization is based on grouping common characteristics and relationships of thesubtypes

12
New cards

entity cluster

a "virtual" entity type used to represent multiple entities and relationships in the ERD

13
New cards

A natural key

key or natural identifier: is a real-world identifier used to uniquely identify real-world objects

− It is familiar to end users and forms part of their day-to-day business vocabulary

-Usually, a data modeler uses it as the primary key of the entity being modeled

14
New cards

surrogate key

-system-generated key (usually numeric) used when natural key is unsuitable.

-a primary key created by the database designer to simplify the identification of entity instances

- has no intrinsic meaning, values for it can be generated by the DBMS to ensure that unique values are always provided

15
New cards

Surrogate keys are useful in the following situations:

− When there is no natural key

− When the selected candidate key has embedded semantic contents

− When the selected candidate key is too long

16
New cards

Foreign key

-attribute in one table that references the primary key in another table to implement relationships

-work with primary keys to properly implement relationships in the relational model

17
New cards

Time-variant data

data whose values change over time and for which a history of thedata changes must be retained

18
New cards

Precedence

Order of evaluation of arithmetic operators in SQL (multiplication/division before addition/subtraction). Used when making computed columns.

19
New cards

Normalization

evaluating + correcting table structures to minimize data redundancies and eliminate anomalies

— by assigning attributes to tables based on functional dependencies and moving relations through normal forms (1NF → 2NF → 3NF).

20
New cards

Denormalization

intentionally reversing normalization to increase performance, but it increases redundancy and requires more I/O operations.

21
New cards

The main goal of normalization

Because it eliminates unnecessary redundancy → which eliminates update / insertion / deletion anomalies and keeps tables well-formed.

22
New cards

Which form of normalization do we want?

An objective is to ensure that all tables are in at least in 3NF

- Higher forms, such as 5NF and DKNF are not likely to be encountered in business environment

23
New cards

partial dependency

exists when there is a functional dependence in which the determinant is only part of the primary key

-The assumption is that there is only one candidate key

24
New cards

transitive dependency

exists when the attribute is dependent on another attribute that is not part of the primary key

− They occur only when a functional dependence exists among non-prime attributes

25
New cards

Normalization starts with the following three-step procedure:

− Eliminate the repeating groups

− Identify the primary key

− Identify all dependencies

26
New cards

atomic attribute

an attribute that cannot be further subdivided. If a value needs to be broken down further (like emp_name into first_name / last_name), it is not atomic.

27
New cards

SELECT

specifies which columns to return

− used to retrieve data from table

28
New cards

FROM

- specifies the table(s) from which the data will be retrieved

- Only columns in the table specified in this clause are available throughout the rest of the query

- clause forms the basis for the rest of the query

− It defines the data that will be available to the remainder of the query

29
New cards

WHERE

filters rows based on a condition

30
New cards

GROUP BY

groups rows to support aggregate analysis

31
New cards

HAVING

filters the groups created by GROUP BY

32
New cards

ORDER BY

sorts the final output ascending or descending

33
New cards

Date Arithmetic

Values are stored as a number of days; it is possible to perform date arithmetic in a query

34
New cards

JOIN

used to combine data from multiple tables

35
New cards

Inner joins

return only rows from the tables that match on a common value

36
New cards

Outer joins

return the same matched rows as the inner join, plus unmatched rows from one table or the other

37
New cards

-A natural join

returns all rows with matching values in the matching columns and eliminates duplicate columns

38
New cards

BETWEEN

Used to check whether an attribute value is within a range

39
New cards

IN

- Used to check whether an attribute value matches any value within a value list

40
New cards

LIKE

- Used to check whether an attribute value matches a given string pattern

41
New cards

− IS NULL

Used to check whether an attribute value is null

42
New cards

NOT

Used to negate a condition. Example:

select * from CH07_LARGECO.testcustomer1 where not cust_balance = 0;

43
New cards

GROUP BY

an SQL clause used to create frequency distributions when combined with any of the aggregate functions in a SELECT statement

44
New cards

EXCEPT (MINUS)

statement combines rows from two queries and returns only the rows that appear in the first set but not in the second

45
New cards

UNION

combines rows from two or more queries without including duplicate rows

46
New cards

Supertype

generic entity that contains common attributes.

47
New cards

Subtype

specialized entity with unique attributes beyond the supertype.