Databases Flashcards
What is a database?
A database is a collection of data
What is an entity?
An ententity is an item of interest about which information is stored
What is a relational database?
A realtional database is a database which recognises the differences between entities by creating different tables for each entity
What are attributes?
Attributes are characteristics of entities, categories about which data is collected
What is a flat file?
A flat file is a database that consists of a single file that is more likely to be based around one single entity and its attributes
What is a primary key?
A primary key is a unique identifier for each record in the table, shown by underlining it (i.e. DoctorID, CarID, etc.)
What is a foreign key?
A foreign key is the attribute that links two tables, acting as a primary key in one table and a foreign key in another (i.e. DoctorID will be a foreign key to the Patient table)
What is a secondary key?
Secondary key allows a database to be searched quickly by setting up a secondary index on an attribute that it’s easier to remember.
A secondary key is a key field which can be used to access a table in a different way.
What are the different degrees of relationships that 2 databases possess when related?
When relating 2 databases there are different degrees of relationships they can possess:
I. One to one;
II. One to many;
III. Many to many;
How do you create a table using SQL code ? (Not on Spec but useful)
CREATE TABLE employee
(
EmpID INTEGER NOT NULL PRIMARY KEY,
EmpName VARCHAR(20) NOT NULL,
HireDate DATE,
Salary CURRENCY
);
How do you insert a new record in a database?
INSERT INTO tableName (column1, column2)
VALUES (value1, value2)
How do you update a record in a table?
UPDATE tableName
SET column1=value1, column2=vallue2
WHERE columnX = value
How do you delete a record in a table?
DELETE FROM tableName
WHERE column=value
What does ACID stand for
Atomicity
Consistency
Isolation
Durability
What is data redundancy
When there is unnecessary data repetition in a database i.e. having different students studying the same subject
Cons that follow data redundancy are
An unnecessary amount of data storage capacity required to store duplicated data
An increased risk of having inaccurate data
It is more time consuming and problematic to update the database so that’s it’s accurate
Data that is inconsistent lacks
Integrity
Data that lacks integrity is
Inconsistent
Using an entity relationship tables have some of the following pros
Less data redundancy and less chance of error leading to inconsistency in the data and less time spent updating the data as it has to be done only in one place
Each table in a entity relationship database represents
An entity