Database Flashcards

1
Q

What is a colum

A

A column is a field that has a single piece of data stored about an entity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a row

A

A row is a record that is a complete set of data (fields) about an individual entity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a table

A

Table or file is all of the known individual entities of the entity type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a key field

A

It uniquely identifies a record / individual entity’s

Forms relationships

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a primary key

A

It’s a unique identifier for each individual record

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a foreign key

A

This is a primary key from another table in order to form relationships

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a flat file database

A

One single table where all the data is recorded for every transaction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the problems with a Flat File Database

A

1: Unnecessary repetition of data
A) waste of resources e.g hardware space
B) take longer to complete: paying staff

2: Data inconsistency - The same piece of data has different values within the database
A) incorrect data
B) lose records/ error in processing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a Relational Database

A

Each table stores data about one entity and are limited together through relationships which are formed by primary and foreign keys

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Advantages of a Relational Database

A

1: No data redundancy: unnecessary repetition of data
- each entities data is written once in the relevant table
- Use key field to refer to it

2: Improved data consistency: each piece of data is the same throughout entire database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a composite key

A

Primary key that consists of more than 1 field. Some or all of those field may be primary keys in another table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an attribute

A

It is a single piece of data for an entity e.g field name ‘member id’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is an entity?

A

It is an object which information is stored e.g student

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the Logical Data Model

A

It is in the design stage
It identifies the entities and the relationships between them using keys
It identifies attributes
It doesn’t describe the physical structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the Physical Data Model

A

It is described from the logical data model
Produced during implementation stage
It creates the table structures such as
-Column Names
-Data type of each field
- Validation rules
The physical implementation differs depending on the actual database management system used

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is unnormalised data

A

It is a list of all the data fields much like a flat file database

17
Q

Explain what 1NF, 2NF and 3NF are

A

1NF - A table is in 1Nf if all attributes are atomic and there are no repeating fields

2NF - A table is in 2NF ( and only if) it is in 1NF and all non key attributes are depends if in whole primary key

3NF - A table is in 3NF (and only if)it is 2NF and there are no functional dependencies between non key fields

18
Q

How do you normalize data

A

1NF - Remove All repeating fields to new table with a copy of the private key

2NF - Fields that are partially dependent on primary key
Part of the primary key which they are dependent

3NF - Fields with a dependency on any non key field
The non key field on which they are dependent

19
Q

What are the advantages and disadvantages of normalization

A

Advantages

  • More efficient due to less redundancy (less hard disk>more storage space)
  • More efficient better data structure, faster processing quicker retrieval of information
  • Less redundancy means less inconsistency in data because data will only be entered once
  • Data integrity is improved

Disadvantage

  • Complex process to create database structure
  • Generates more tables than de-normalized tables can lower efficiency
  • Complexity, hard to use the database
20
Q

What is referential integrity

A

Referential Integrity- Cannot enter a value for a foreign key field, if that value is not present in the referenced table (eg cannot add invoice in the invoice table linked to customer no 47 if there isn’t a number 47 in customer table)
A primary value cannot be changed or deleted if it is referred to I.e. the same value is listed on a foreign key in another table

21
Q

What is a Data Dictionary

A

It is a list of all of the fields in the database contains all of the ‘meta data’ about each field e.g
Field name
Validation rules
Data type

22
Q

What is the purpose of a Data dictionary

A

A data dictionary is useful when lots of people are working on the same system, we have consistent naming throughout the database
E.g. Foreign key in one table used the same name as the primary key in its linked field

23
Q

What is the SQL code for creating a table

A

CREATE TABLE table_name (col1, col2)

24
Q

What is the SQL code for retrieve (select)

A

SELECT Field
FROM table name
WHERE criteria (search criteria)
ORDER BY col1 ASC

Ascending*
SELECT author title 
FROM Books
WHERE category = “Science”
ORDER BY author DESC
25
Q

What is the SQL code of adding (inserting) data into a table

A

INSERT INTO table name

VALUES (data being inserted) (“Example”, “Test”)

26
Q

What is the SQL code for updating data

A

UPDATE table name
SET col1 = “work” what data is changing
WHERE col2 = “test”

Example
UPDATE tbl customer
SET status = “suspended”
WHERE balance <=0

27
Q

What is the SQL code for Deleting records

A

DELETE FROM table name

WHERE col1 = “test”

28
Q

What is the difference between SQL and QBE (advantages and disadvantages)

A

Structured Query Language (SQL)
Insert code in specified format
… using SQL commands to create/use database e.g. CREATE, INSERT INTO, UPDATE etc
Adv- Creates more complex and powerful queries
Disadvantages- Complex- only suitable for experts, big learning centre

Query by Example (QBE)
Use graphical interface 
...Filling in forms
... Inputting criteria 
...Selecting options 
Adv- Easy to use for non experts 
Quickly create queries 
Disadvantages- Limited to options provided by QBE interface (less powerful)
29
Q

What is a query

A

All instructions are queries
Create table
Forming relationships