8 - data bases Flashcards

1
Q

database

A

structured collection of items of data that can be accessed by different applications programs

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

table

A

group of similar data withe rows and columns

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

record

A

a row - one instance if an entity (tuple)

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

tuple

A

a row - one instance if an entity (record)

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

field

A

column - data item stored for an entity eg name (attribute)

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

entity

A

anything that can have data stored about it eg person place thing

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

attribute

A

column - data item stored for an entity eg name (field)

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

cadidate key

A

the smallest number of attributes where no row has the same value (all unique)

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

primary key

A

unique identifier of a table

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

secondary key

A

alternative to the primary key

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

foreign key

A

set of attributes that refer to another tables primary key

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

relationship

A

one table in a database has a foreign key that refers to a primary key in another table in the database
1:1
1:m
m:1
m:m
(the many always has the foreign key)

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

referential integrity

A

database doesn’t contain any values of foreign key that don’t match the corresponding primary key

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

index

A

a data structure built from one or more columns in a database table to speed up searching

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

ER diagram

A

a graphical representation of a database and the relationships between

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

normalisation

A

the process of organising data to be stored in a database into 2 or more tables and relationships between the tables (redundancy is reduces)

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

1NF

A
  • data is atomic - cant be split further
  • no repeating attributes
  • each table has a primary key
  • each field name is unique
18
Q

2NF

A
  • must be 1NF
  • remove partial key dependencies - where an attribute in a table depends on only a part of the primary key not the whole key
19
Q

3NF

A
  • already in 2NF
  • remove transitive dependencies - where non key attribute depends on another non key attribute
20
Q

composite key

A

set of attributes that form a primary key to provide a unique identifier for a table

21
Q

limitations of file based approach

A
  • redundancy - storage space wasted when data is duplicated by separate applications
  • inconsistency - data is altered by one application and not another
  • dependencies - enquires can depend on the structure of data and software used
22
Q

+ of relational databases

A

+ no redundancy - storage space not wasted as data only stored once
+ no inconsistencies - data altered in one app is available in another
+ independent - enquires arent dependent on the structure of the data and software

23
Q

DBMS

A

system software for the definition, creation and manipulation of a database

24
Q

how DBMS fixes file based approach

A
  • redundancy - data is stored in separate tables - flags errors when keys are deleted or data is repeated
  • inconsistency - stores most items once - allowing updates to be seen by all apps
  • dependency - each app only has access to what it requires - DBMS has facilities to query data
25
Q

DBMS features

A
  • data management
  • data dictionary
  • data modelling
  • data security
  • data integrity
26
Q

data management

A

organisation and maintenance of data in a database to provide info required
- entry, storage, alteration, deletion of data

27
Q

data dictionary

A

a set of data that contains metadata for a database
- definition of tables, attributes, relationships between tables and indexing or validation rules or data about the physical storage

28
Q

data modelling

A

the analysis and definition of data structures required to produce a data model - shows struture by ER diagrams

29
Q

logical schema

A

a data model for a specific database that is independent of the DBMS used to build that database

30
Q

data security

A
  • passwords
  • access rights
  • backup
  • encryption
  • creates audit trail/ activity log (to record actions by users)
31
Q

DBMS software tools

A
  • developer interfaces
  • query processor
32
Q

developer interface

A

allows a developer to write queries in SQL rather than query by query

33
Q

SQL

A

structured query language
standard query lang used with relational databases for data definition and data modification

34
Q

query processor

A

takes an SQL query and processes it
includes a DDL interpreter,
DML compiler and query evaluation engines

35
Q

DDL

A
  • used to create, modify and remove data structures
    DDL statements are interpreted and recorded in the data dictionary
36
Q

DML

A
  • used to add, modify delete and retrieve data in a relational database
    DML is compiled into low-level instructions and executed by the query evaluation engine- the query is optimised
37
Q

DDL data types

A
  • character - fixed length eg 5
  • varchar(n) - variable length up to max
  • boolean
  • integer
  • real
  • date
  • time
38
Q

DDL statements

A
  • CREATE DATABASE <name></name>
  • CREATE TABLE <name> (<attributes> <TYPE>,…PRIMARY KEY (attribute));</TYPE></attributes></name>
  • ALTER TABLE <name> ADD PRIMARY KEY (<keyname>)</keyname></name>
  • ALTER TABLE <name> ADD FOREIGN KEY <keyname> REFERENCES <table>(<keyname>) (references the table where the key is primary to create relationship)</keyname></keyname></name>
39
Q

DML query commands

A
  • SELECT <field> FROM <table></field>
  • WHERE <criteria></criteria>
  • ORDER BY <field> ASC/DESC</field>
  • GROUP BY
  • INNER JOIN <field> ON <criteria> (combines rows)</criteria></field>
  • SUM
  • COUNT (counts the number of rows where the column isnt NULL)
40
Q

DML maintenance commands

A
  • INSTERT INTO <table> VALUES ()
  • DELETE FROM <table> WHERE <criteria> have to delette from all tables</criteria>
  • UPDATE <table> SET <thing> WHERE <condition></condition></thing>