-
What is a database system?
DBS- a computerized record keeping system
-
Components of a DBS
The database, the software, hardware, and its users
-
What is Data?
- Facts about an entity or an event. (Raw data that needs to be processed in order to become useful)
- Individual test scores
-
What is information?
- Processed data
- Average test score of a class
-
Input data
Anything you type into a database
-
Output data
Response to a query
-
What are the subsets of persistent data?
Operational data and decision support data (DSD)
-
What is persistent data?
- Data that cannot be 100% removed from the database
- (Can’t delete 100% of students or their IDs, their grades, etc. only if they move schools)
-
What is operational data
- Subset of persistent data.
- Data subject to operations.
- Core data and relationships about core entities
-
What are subsets of operational data?
Core data and associate data
-
What is core data
- Subset of operational data.
- Data about the core entities of a database (what the database is focused on)
- For example: students, banking customers
-
Associate data
- Subset of operational data.
- Data about relationships among core entities.
- For example: if name (core data) and age (core data) are represented in a column next to each other- then they are associate data
-
Different relationships of associate data
Unary, binary, ternary
-
Unary relationship
- Object is related to itself
- ie. Parts made of sub-parts
-
Binary relationship
- Two involved in relationship.
- ie. Part is produced by a producer
-
Ternary relationship
- 3 parts.
- Part, producer, seller
-
Decision support data
- DSD- subset of persistent data.
- Data used to perform operations, not physically stored.
- ie. Total number of students in class
-
What is a database?
A collection of persistent data regarding an enterprise.
-
Components of a database system
Database, software, hardware, users
-
Software component of a database system
Database management system (DBMS)
-
What is a DBMS in charge of?
Intercepting query, checks validity of query (in terms of syntax and semantics), and if ok- it implements and resolves to entity the issued query.
-
What are data languages and how they relate to DBMS?
- Incomplete languages with only minimum # of statements needed to issue queries (no do while like java).
- DBMS must always be able to handle a data language (like SQL).
-
Hardware component of a database system
Need to have hardware to run software
-
User component of a database system and sub components
- People who use DBS....
- End users, application programmer, database administrator
-
End users of a DBS
Customers, people who know nothing about database systems (yet have all authority)
-
Application programmer of a database system
Knows at least one data language (can use queries, create reports, etc.)
-
Database administrator (DBA) of a database
- Person or team in charge of collecting needs of the user, and designing, creating, populating, and protecting the DB.
- If the organization is big (Amazon/Walmart), designing responsibilities go to Data Manager.
-
More specific responsibilities of DBA
- Designs DB
- Decides content of DB
- Ensures satisfaction of the user and their requests
- Provides security
- Creates data dictionary
-
Data dictionary role of a DBA
Data about data. This is your job security, don’t make it easy for someone else to take over.
-
General issues with a DBS
- Integrity
- Inconsistency
- Redundancy
- Security
- Balancing of conflicts
- Data independence
-
Integrity issues in a DBS
- Correctness of data...
- If you say nobody makes more than 100 grand but John is listed having 125 grand
- Make sure there is a threshold/restriction for data entries?
-
Inconsistency issues in DBS
- Data is correct but not matching...
- ie . Two different salaries under a name (after raise) OR two different last names (after a divorce)
- Make sure ALL data is updated after changes
-
Uncontrolled redundancy issues in a DBS
- Having more than one copy of data...
- Uncontrolled redundancy- Storing the same information unnecessarily (like a customers address who buys several things)
-
Controlled redundancy in a DBS
- Getting minimum redundancy for sake of navigating among tables.
- ie. Backing up a companies files nightly
-
Security issues in a DBS
- Internal- security against people who have access to database (housing dept. doesn’t need to see your grades, lvl 5 SCP clearance)
- External- security against people who are outside your organization.
-
Interpersonal conflicts in a DBS
- ie. One department wants day/month/year, other wants month/day/year.
- OR one wants all metric units, other wants empirical (caused NASA explosion)
-
Data independence issues in a DBS
Not sure yet
-
What is a domain
A collection of data that have the same type
-
What is a attribute
Subset of a domain
-
What is a relation
A subset of Cartesian product of not necessarily distinct domains
-
What is a tuple
(A row in a table) An instance of Cartesian product of not necessarily distinct domains that appear in a relation
-
Rules of a tuple
- Every value in a given attribute is atomic
- All attribute values of a given attribute come from same domain
- Order of tuple and attributes is insignificant
- No duplicate tuples
-
Cardinality of a relation
Number of tuples
-
Degree of a relation
Number of attributes
-
Candidate key
Attribute or group of attributes whose values can UNIQUELY identify every tuple in a relation
-
Conditions for candidate key
Uniqueness and minimality
-
Primary key
The selected candidate key
-
Alternative key
Candidate key that’s not your primary key
-
Super key
Candidate key that satisfies ONLY uniqueness (ST-ID, Name, Age)
-
Entity integrity
A primary key or any component of it must have a value (can’t be null) and cannot be known
-
Referential integrity
Referring to a tuple that doesn’t exist ( student listed one class but not database)
-
Primary domain
Location you’re extracting primary key from
-
Foreign key
An attribute (or group) that appears in multiple relations (and comes from same domain) but is not used as the primary key
-
Union compatible conditions
- The degree (# of attributes) of both relations must be the same
- Data for corresponding attributes (A and A’) must be from same domain
- No duplicates
-
intersecting relations
- Must be union compatible
- Common elements/ tuples is result
-
Subtract relations
Result is unique element in first set. S1={1,2,3}, S2={1,4,3}, S1-S2=2... S2-S1=4
-
What does select do?
Takes horizontal subset of relation where __ = __ and places that tuple into relation __
-
Times relations
Concatenation every tuple in one relation with every tuple in another
-
Equi join
(W1 = R1 equi join R2 where R1.B = R2.E) Concatenation every tuple in one relation with every tuple in the other. Result is many attributes
-
Natural join
Concatenation all tuples with each other and only keep ONE copy of attribute values
-
Theta-join
Equi join where there are duplicates under a condition
-
Different inner join
- Equi join
- Natural join
- Theta join
-
Different outer join
- Left outer join
- Right outer join
- Full outer join
-
Left outer join
- (X1 = R1 left outer join R2 where __ = __;)
- Normally join where there are duplicates then add tuples from the left relation that didn’t have a match
-
Right outer join
- (X1 = R1 right outer join R2 where __ = __;)
- Normally join where there are duplicates then add tuples from the right relation that didn’t have a match
-
Full outer join
- (X1 = R1 left outer join R2 where __ = __;)
- Normally join where there are duplicates then add tuples from the left relation and then the right one that didn’t have a match
-
Semi join
- (X1 = R1 semi join R2 where __ = __;)
- Normally join and then drop all R2 attributes and duplicates
-
Dividing relations rules
- N = degree of dividee, K = degree of dividend.
- K must be > n
- K = m+n
- N must come from same domain
-
Dividing relations steps
- Find n (degree of divisor)
- Find k in dividend (remember k=m+n)
- Makes sure n is from same domain
- Get each corresponding value for values in divisor and place in their own set
- Intersect sets
- New set equals the result of intersection
|
|