U1T2 - Databases Flashcards
Databases
What is a database?
Collection of data shareable between diff apps. Structured so data can be searched. + retrieved.
What are the disadvantages of a paper database?
Lots of paper, 1 person at time, long time to find, docs get lost.
What are the advantages of computer databases?
Lots data, small space, quick, less likely to be lost + multiple users at once.
What are the disadvantages of computer databases?
Comp equip expensive to buy + install, data collection + setup expensive, staff need training + if system fails, can’t get info.
What is a logical database model?
Determines if all business’s requirements gathered.
What does a logical database model do?
Identifies entities + relationships with keys and attributes. Produced during design phase. Gather info about business needs, doesn’t design database, used across various database software + implementations, includes ERD, business process diagrams + user feedback documentation.
What is physical database modelling?
Depends on software being used in organisation. Software specific.
What does a physical database model do?
Produced during implementation. Describes table content, fields + records + criteria. Derived from logical. Required for database design, software + hardware specific + has indexes + constraints, includes server model diagram, database design documentation + user feedback documentation.
Flat-file System
Single table used to hold all data for app. 1 row for each record + 1 column for each field. Data redundancy high here.
Relational Database
Complex structure made of several related tables consisting of records which contain data linked by foreign and primary keys. Data items uniquely identified by primary key. Tables set up acc. to normalisation rules.
Describe tables.
Contain records (each holds all data about 1 thing), records divided into fields, each holding 1 piece of data about 1 thing. Fields have data types.
What are the diff data types?
Text, number, date/time, currency, yes/no + autonumber.
Describe these data types:
Text
Number
Date/Time
Letters, symbols + numbers (Alphanumeric)
Numbers only (Can hold decimal places)
Dates + Times
Describe these data types:
Currency
Yes/No
AutoNumber
All monetary data (Includes symbols £, $)
Yes/No, True/False (Data can only be 1 or other)
Unique value generated by Access for each diff record.
What is a key field/primary key?
Field/attribute that uniquely identifies one record in a table.
What is an entity?
Object about which data is stored.(table)
What are attributes?
Data item held in entity. aka field.
What is a relationship?
Link/association between 2 entities. Foreign key links to primary key. E.g. Dentist + Patient,
What are the 3 types of relationship?
One-to-One (1:1), One-To Many (1:m) + Many-To Many (m:n)
Give an example of each type of relationship.
1: 1
1: m
m: n
Husband + Wife
Mother + Kids
A Level Students + Subjects
What does a data model include?
Entity, attribute + relationship. Usually diagram of database.
What is an ER diagram?
ENTITY-RELATIONSHIP Diagram. Diagrammatical way of representing relationships between entities in database.
What is a foreign key?
Primary key from 1 table which is used as link in another table.
What is a composite key?
2+ attributes used together to uniquely identify 1 record in a table.
What are the 3 types of keys?
Primary, Foreign + Composite.
What does referential integrity do?
Uses foreign key + its primary key to ensure there are no orphan records (alerts you + can’t delete related records). Can be used to cascade changes made to database. Ensures data in 1 table doesn’t contradict that in another. Foreign keys must have matching primary keys.
What does each foreign key have?
Matching value in corresponding primary key.
What is data consistency?
Data stored same in all places where it’s recorded.
What is data inconsistency?
Not all data stored same in all places where it’s recorded.
What is data integrity?
Accuracy + correctness of data stored.
What is data redundancy?
Same data stored more than once unnecessarily.
What is data independence?
Data not being dependent on structure of program used.
What is normalisation?
Step by step process for analysing data into constituent entities + attributes. Improves database efficiency. Uses set of rules to structure tables.
What are the outcomes when data is normalised?
No data unnecessarily duplicated, data consistent throughout database, structure of tables flexible so data can be added/removed + structure should enable complex queries involving related tables. Reduces update anomalies such as insertion, deletion + modification.
What is the purpose of normalisation?
Ensure data is recorded once only to avoid data duplication + inconsistency.
What are the 3 stages of normalisation?
First, second + third normal form.
Describe each stage of normalisation.
1NF - Remove Repeating Groups
2NF - Remove attributes only dependent on part of comp/prim key (partial dependency)
3NF - Remove attributes not dependent on primary key (Non key dependencies) No transitive dependencies.
What are the advantages of a relational database over a flat file?
Data stored once, complex queries can be carried out, less space, faster, better security + cater for future requirements, avoids inconsistent records, easier to change data + data format, data easy to add/remove. Less program-data dependencies (file format specified in each group), more productive maintenance + fewer data sharing issues.
What are the advantages of not sharing data multiple times?
No multiple record changes needed, more efficient storage, easy to delete/mod details + all records in other tables which have link to that entry show the edit.
Why can complex queries be carried out in a relational database?
SQL. Allows programmers to update, insert, delete, create + drop table records. Actions further refined by where clause.