1.3.2 databases Flashcards
some notes on paper and some rewritten from flashcards as stuff i didn't get
what is a database
- An organised collection of data (persistent organised store of related data)
what does organising data in an electronic database allow for? (advantages)
- easier + quicker adding, modification, deletion, updating and searching
- easier to back up data
- can be accessed by multiple people at the same time from different locations
what is data
- information stored which can to be personal in some cases
- it can be collected and analysed
what is information
- facts and details about a certain thing in context.
what is knowledge
- something humans obtain/acquire and remember by reading or searching up topics to broaden understanding.
what is a relational database
- Where data is stored in tables grouped by entity and linked (related) together.
what is a relationship and what is needed in both tables for it to work
- link between tables
- we need a common field in both tables for relationship to work
when designing a relational database and linking tables, relationships come in what 3 forms?
- one-to-one
- one-to-many
- many-to-many
what do we use to sketch the relationships between tables
- entity-relationship diagram (ERD)
- can also call it entity-relationship model
what is a flat file database. what is a suitable use for this type of database (think in terms of quantity of data)
- A database with multiple independent tables or only 1 table
- no links between tables
- suitable to store small amount of data e.g contact details, small product database, maintain game/music collection
what is a flat file database normally saved as
- a comma-separated values file (CSV)
what are the positives to a flat file database
- simple + require little expertise to maintain
- quick to set up
what are the downsides to a flat file database
- no links –> inefficient
- can become difficult to maintain and update
- not easy to query
- data can be easily duplicated (take up unnecessary space due to redundancy)
what are the advantages of a relational database
Data Integrity
Linked tables
Easier to change format
Provides security features
what is a primary key
- field in a table that is unique for every record
what does the primary key ensure for each record
- primary key ensures that each record is distinct from the others.
what is a foreign key
- it’s the unique primary key field of one table that is stored in another for purpose of creating a link between the tables.
(linking field in a table that is a primary key in a related table)
fill the gaps:
- a foreign key value must have a corresponding _________ ____ value in another _____
- primary key
- table
In order to combine information from two tables, there must be a what?
- there must be a primary/foreign key pair.
what are composite keys are made up of.
- more than one attribute
give an example of composite key used for taking one school course
- none of the attributes on their own (Subject and StudentID) can be guaranteed unique.
- But, a student can only enrol for a subject just once so combination of Subject and StudentId will be unique.
- Combining these two attributes will form a composite primary key. (to uniquely identify a record)
what is a secondary key
- a field by which records are likely to be searched and is therefore indexed
what is meant by “indexed”
- process of creating a linked list (database index) to improve speed of data retrieval operations on a dataset table at the cost of additional writes and storage space to maintain the index data structure.
why do we consider using secondary keys
- we may wish to search by field other than primary key
- filed being indexed takes up extra space but speeds up searching
what is an entity
what are the 2 types of entity existence (1st begins with p and 2nd begins with c)
- real world object that we want to store data about.
- physical existence e.g. a customer / product
- conceptual existence e.g. an order / booking