Option A: Database (CS SL)

0.0(0)
studied byStudied by 9 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/45

flashcard set

Earn XP

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

46 Terms

1
New cards

Data

Raw fact that is meaningless on it’s own / unprocessed values

2
New cards

Information

meaningful data that has been interpreted / added context or meaning

3
New cards

Information system

Collection of hardware, software and human resources that work together to transform raw data into useful information

4
New cards

Database

Organized of data stored electronically and is a component of the information system, it is stored in tables as records (rows, data about one particular person / company / item in a database) and fields (column, part of a record and contains a single piece of data for the subject of the record)

Created and stored by a software called DMBS (SQLite, mySQL, SQLserver)

5
New cards

Queries / Commands

store, retrieve, delete and edit data

6
New cards

Why do we use database

  • processing / querying data (search / sort / analyze)

  • generate reports

  • automatically support data validation / data verification when filling the database

  • standardized (used in multiple systems)

  • provides ability to sore a greater number of records compared to a spreadsheet

7
New cards

Data Validation

Checks that input follows rules for the type of input entered

8
New cards

Data Verifiction

Checks that input matches expected values in database

9
New cards

Entity

  • a real world object / person

  • represented by a row

  • referred to as a record / tuple in a database

10
New cards

Table

  • stores a set of related data called records

  • every record has value

  • records in each table share the same fields / types of data

11
New cards

Tuple

Collection of items that may or may not be related to one another

12
New cards

Collection of items that may or may not be related to one another

13
New cards

Primary Key

  • identify a given record

  • distinctive for each record

14
New cards

Foreign Key

  • primary key field in another table

  • connect record in one table to another

15
New cards

Data types

text, char, boolean, int, real, datetime

16
New cards

Secondary / Alternate Key

  • values that can be used as primary key (PK cannot be NULL, but SK can)

  • can have more than 1 SK

17
New cards

Candidate Key

  • Identify each unique record in a database

  • both PK and SK are candidate keys

18
New cards

Composite PK

when one field is not enough to uniquely identify records, but 2 fields together can work as a PK

example: name & birthday

19
New cards

Database Schema

  • defines how data is organized

  • overview of the database

  • organizational chart

20
New cards

Relational Database

  • tables are related to one another

  • each table has a PK

  • columns → attributes

  • rows → records, if none then tuples

21
New cards

Referential Integrity

  • row → identifier / PK

  • relations between table are consistent and logical

22
New cards

Database Management System (DBMS)

set of programs that allow to read, store, change / extract data in a database

example: SQLite, mySQL, PostgreSQL

23
New cards

Components of DBMS

  • data dictionary

  • data safety

  • query processor

  • storage engine

  • concurrency

  • security

24
New cards

Data Dictionary

  • file or set of files that store information about the database and the tables inside

  • manage metadata / metadata repository

25
New cards

Data Safety

backup & recovery, data integrity

26
New cards

Query Processor

accept queries and return appropriate output

27
New cards

Storage Engine

handles, create, read, update and delete operations

28
New cards

Concurrency

allows multiple users to access database; make sure multiple user can’t modify the same data simultaneously

example: row - locking

29
New cards

Security

enforce user policies, include:

  • access rights

  • audit trails: changes made to the data

  • data locking: lock rows that are accessed

  • validation: make sure new data follows rules

  • encryption

  • back ups: update copies

30
New cards

Database Transactions

  • collection of low - level tasks

  • set of SQL statements executed sequentially

  • all operations are performed and if there is an error, changes either made permanent or save changes commited if not partially or reverted or rolled back

31
New cards

ACID

  • Atomicity: all task performed or none

  • Consistency: all data written must be valid

  • Isolation: no transaction will interfere

  • Durability: once transaction is complete, changes are permanent even with system failure

32
New cards

Purpose of transaction

make sure changes don’t run into each other & is permanent

33
New cards

Data Integrity

  • data should be what the user means it to be

  • accuracy, completeness, validity

34
New cards

Data Redundancy

situation where the same piece of data is stored in 2 or more different place

pros:

  • faster data access

  • better protection

cons:

  • data inconsistency (updated at one place)

  • more storage used

35
New cards

Normalization

process where larger tables are divided into smaller tables while ensuring data integrity and reduce data redundancy

36
New cards

Why we use Normalization

  • reduce data redundancy (storage)

  • reduce table complexity (insertion, updates and deletion less error prone

  • make sure data is stored logically (to make querying more efficient)

37
New cards

The 1st Normal Form (1NF)

  • eliminate duplicate columns, multiple types of value

  • create separate tables for each group

38
New cards

The 2nd Normal Forms (NF)

  • meet requirements for 1NF

  • eliminate partial dependency, 2PK, columns dependent on one attribute of a composite PK

39
New cards

The 3rd Normal Form

  • meet requirements for 2NF

  • eliminate transitive dependency (column depending on another column)

40
New cards

Advantages of Normalization

  • less data storage required → lack of duplicates

  • data is more likely to be consistent

  • increased data security → easy to locate

  • operations are conducted more quickly and efficiently due to table structure

  • simpler queries

  • easier to understand as it is logically organized

41
New cards

Anomalies

  • prevented by 2NF

  • three types of anomaly:

    • insertion anomaly: or cannot be inserted due to missing data

    • deletion anomaly: when certain attributes are lost due to deletion of other attributes

    • update anomaly: data only partially updates

42
New cards

Database Administrator (DBA)

ensure that data is performant, secure, and recoverable by: updating database, maintaining security, managing back up procedures, and establishing recovery plan

43
New cards

Database Definition Language (DDL)

  • commands that allow us to define and modify the structure and metadata of a database

  • generate data dictionary

  • only available to DBAs

  • DDL commands: alter, create, drop, truncate, rename

44
New cards

Data Modelling

  • visual representation of a whole / part of an information system

  • helps stakeholders have a shared understanding of a system

  • Three types:

    • conceptual: rough sketch, entities

    • logical: 4 entities, attributes, FK

    • physical: data, data type, attributes, relationship

45
New cards

Advantages of Data Modelling

  • avoid issues:

    • redundancy

    • lack of integrity

    • lack of consistency

  • helps developers develop actual database

  • lack → deficient modelling

46
New cards
<p>ERD (Entity Relationship Diagram)</p>

ERD (Entity Relationship Diagram)

<p></p>