04 databases Flashcards

(88 cards)

1
Q

what is a database?

A

a collection of data organised in a manner that allows access, retrieval and use of that data. It is a set of related data.

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

what is data?

A

Data is the raw form of knowledge and doesn’t carry any significance. Simple and useless. Examples:
- facts
- raw & unorganised
- individual & unrelated
- doesn’t depend on information
- graphs, numbers, figures

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

what is information?

A

knowledge gained through study, communication etc. It is a result of analysing and interpreting data and relating it together. Examples
- puts facts into context
- organised
- related & makes sense in context
- depends on data
- works, thoughts etc.

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

what is a primary key

A

a primary key uniquely identifies each record. For example, a patient ID, that links to a appointment entity.

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

what is file maintenance

A

it refers to the procedures that keep data current, this includes things like:
- adding records
- modifying records
- deleting records

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

what is data dictionary

A

A data dictionary is a document that defines the basic organisation of a database. It contains a list of all the elements in the database, the number of records in each table and the names and types of each field.

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

what is a flat file database

A

A flat-file database is a collection of data where information is stored in a single table/two dimensional database. Data is arranged in rows (records) across columns (fields).

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

what is a relational database

A

A relational database has multiple tables that are related together, through keys. It allows for more flexibility and control over database constraints. It is usually created through a process called normalisation.

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

what is a DBMS (database management system)

A

DBMS is a specially designed software application that interacts with the user, other applications and the database itself to capture and analyse data. The purpose of a DBMS is to allow the definition, creation, querying, update, and administration of databases. A database file is not generally portable across different DBMSs, but different DBMSs can interoperate by using standards such as SQL and ODBC to allow a single application to work with more than one database.

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

what is a RDBMS (relational database management system)

A

A RDBMS allows developers to store and handle data in multiple tables. It is a collection of programs and capabilities that enable IT teams and others to create, update, administer and otherwise interact with a relational database. RDBMS’s store data in the form of tables, with most commercial relational database management systems using Structured Query Language (SQL) to access the database. It provides a dependable method of storing and retrieving large amounts of data while offering a combination of system performance and ease of implementation.

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

what are 3 features of RDBMS

A

Data storage
The relational tables are structured for storing and retrieving data. It takes care how the data is organised on the disk, where it is stored and how the data moves when you update it.

Data Management
When we create the data into our database, we can insert data into the database. The data management manages the physical storage of data and works closely with the data storage module. Allows user to do data lookup operations, though SELECT, UPDATE and DELETE statements.

Data Concurrency
Allows the administrator & users to use the same database whilst performing different operations. Multiple users, applications and reports might connect to them. They can read and modify data in the database at the same time.

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

what are the two types of data consistency

A

Two or more users making changes at the same time on the same piece of data can cause conflicts and inconsistencies in the database. This is avoided by the use of transactions and locks.

Transactions
Consists of an entire set of changes a user makes, up to when the user presses a button to run a command.

Locks
Users can ‘lock’ a table , row or columns so only 1 user can modify it at one given time.

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

DBMS vs RDBMS

A

DBMS
- general term for a database system
- hierarchical, network etc
- doesn’t have relationships
- other languages
- doesn’t have advanced features.

RDBMS
- relational databases
- stores data in rows & columns in tables
- primary and foreign keys
- SQL as standard language
- advanced data management features

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

what is the role of a RDBMS in handling access to data

A

Uses complex algorithms that support multiple concurrent user access to the database while maintaining data integrity. Security management is an overlay service that the RDBMS provides for the basic database as it is used in enterprise settings. RDBMS’s support the work of database administrators (DBAs) who manages and monitors database activity. RDBMS’s manage log files that track system performance based on selected operational parameters. This enables measurement of database usage, capacity and performance, particularly query performance. RDBMS’s provide graphical interfaces that help DBAs visualize database activity.

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

what are the two types of independence of data from RDBMS

A

Logical data
Refers to immunity of external schemas (external views) to changes in conceptual schema. Conceptual schema changes (e.g. addition/removal of entities).
Should not require changes to external schema or rewrites of application programs.

Physical data
Refers to immunity of conceptual schema (database model) to changes in the internal schema. Internal schema changes e.g., using different file organizations, storage structures. Should not require change to conceptual (external) schemas.

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

what is an entity

A

an entity is a table. It is a person, place, object, event or a concept.

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

what is an attribute with an example about patients details.

A

It defines an entity. For example, a table of patients. Some attributes of patients are patientID, Name, Section, DoB, Gender etc. Records are stored in rows and are a collection of related attributes.

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

Entities/relations v tables/files

A
  • An Entity is implemented in the form of a file/table
  • An Entity in an ER model can also be referred to as a ‘Relation’ when all fields are atomic and there are no repeating fields (1NF)
  • A Database can contain many tables/Files in relation
  • Tuples or rows are implemented as records
  • Attributes are implemented as fields in your data dictionary
  • Relationships remain relationships (1:M, 1:1, M:N) but referential integrity is enforced
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

what are some entity types

A

Tangible Entity
The Entity or Object which exists in the physical world. You can physically touch it.

Intangible Entity
The Entity or Object that has a logical definition but does not exist physically.

Entity type
The collection of an object with similar attributes.

Strong Entity Type
Strong entities have a key attribute by which each instance can be identified .

Weak Entity Type
This type of entity doesn’t have a main or unique attribute. Weak entity types require borrowed attributes from other entities for its precise identity.

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

rules for relational databases

A
  1. Each table has a unique name
  2. Each table contains multiple rows
  3. Each row in a table is unique
  4. Every table has a key to uniquely identify rows
  5. Each column in a table has unique attribute names
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

what is a composite/compound key

A
  • composed of multiple attributes
  • only the combination of attributes uniquely identify as records
  • considered weak.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

what is a foreign key

A

It is a field whose value is the same as a primary key of another table.

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

what is a cardinality

A

the relationship of a relational database (1:1, 1:M, M:N)

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

what is a 1:1 relationship

A
  • a student has 1 locker and 1 locker has one student
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
what is a 1:M relationship
- one owner can have multiple pets
26
what is a M:N relationship
- one actor can appear in many films and one film can have many actors. - they need to be resolved to remove the M:N relationship
27
what is an anomaly
An anomaly is when you try to modify a table, some side-effects may follow. They can arise in tables that have not been modified.
28
what is an insertion anomaly
1. When data is added and not all the data is known, some fields will be null. 2. When data is repeated in the table.
29
what is a deletion anomaly
When a record is deleted and results in the loss of other data that only occurs in that record.
30
what is the problem with anomalies and flat file databases.
flat-file databases can cause lots of problems with the data. They can cause update, insertion and deletion anomalies to occur as it is one big related table, instead of small little related tables.
31
what is a update anomaly
A problem that occurs when data that is repeated in a number of records that requires updating. If all records are not updated the data could become inconsistent or inaccurate.
32
what is a good thing about relational databases and anomalies
It holds its data over a number of tables instead of one. Records within the tables are linked (related) to records held in other tables.
33
what is referential integrity
Means that foreign keys in a table should have a valid corresponding primary key in another table. Therefore, in the case of the First name DVD rentals, for every custom, there should be at least one or more records in the DVD rental file
34
name the 7 types of purposes of database documentation
1. Understanding the database structure 2. Database design guidelines 3. Querying and manipulating data 4. Data relationships and constraints 5. Database security and access control 6. Troubleshooting and performance optimisation 7. Collaboration and knowledge sharing
35
what is the purpose of database documentation
It is to provide comprehensive and detailed information about the structure, design and functionality of the database. It serves as a reference and guide for developers working on the database.
36
explain the purpose of database documentation (1. Understanding database structure)
Documentation helps developers understand the overall structure of the database, including tables, fields, indexes, and relationships. It provides a clear picture of how data is organized and stored within the database.
37
explain the purpose of database documentation (2. database design guidelines)
Documentation outlines the design principles and guidelines followed while creating the database. It explains the rationale behind the design choices, such as table structures, data types, naming conventions, and normalization techniques. This helps developers adhere to consistent design standards and make informed decisions when modifying or extending the database schema.
38
explain the purpose of database documentation (3. querying and manipulating data)
Documentation includes information about the available queries, stored procedures, functions, and other database operations. It provides details on how to retrieve, insert, update, and delete data from the database, along with examples and best practices. This helps developers write efficient and optimized database queries.
39
explain the purpose of database documentation (4. data relationships and constraints)
Documentation describes the relationships between different tables using primary keys, foreign keys, and other constraints. It explains how these relationships should be maintained and how referential integrity is enforced. Developers can refer to this information to understand the dependencies between tables and ensure data consistency.
40
explain the purpose of database documentation (5. database security and access control)
Documentation may include information about the security measures implemented in the database, such as user roles, permissions, and authentication mechanisms. It guides developers on how to handle sensitive data and implement proper access controls to protect the integrity and confidentiality of the database.
41
explain the purpose of database documentation (6. Troubleshooting and performance optimization)
Documentation may contain troubleshooting tips, common issues, and performance optimization techniques specific to the database. It helps developers diagnose and resolve database-related problems efficiently, improving the overall performance and reliability of the system.
42
explain the purpose of database documentation (7. collaboration and knowledge sharing)
Database documentation serves as a centralized source of information that can be shared among developers, database administrators, and other stakeholders. It promotes collaboration, consistency, and knowledge sharing within the development team, ensuring everyone has access to accurate and up-to-date information about the database.
43
what are the 3 types of data modelling techniques
Conceptual data modelling: examines the business's operations, intending to create a model with the most important parts (such as describing a store's order system). Essentially, this data model defines what data the system will contain. Example: Data Flow Diagram (no longer taught in ATAR Computer Science). Logical data modelling: is more detailed than a conceptual model. A logical model includes information about the data entities and their relationships. However, a logical design model is independent of any technology on which its design could be implemented Example: Entity-Relationship Diagrams. Physical data modelling: examines how the database will actually be implemented, intending to model how the database elements will interact with each other. Here, the actual database is created; the schema structure is developed, refined, and tested. Data models generated should support key business operations. Example: Data Dictionary
44
what are some elements of a data dictionary
- entity name - element name - data type - size/format default - description - constraint (PK, FK, not null)
45
how do you remove 'multi-valued' fields
create a relational database and link them together with primary and foreign keys.
46
what is an entity relationship diagram
An ERD is a visual representation that illustrates the relationships between entities in a database. An ERD uses various symbols and connectors to represent entities, attributes, and relationships between them.
47
what are the main components of an ERD
Entities It is typically depicted as a rectangle in an ERD. Each entity has attributes that describe its characteristics. Attributes They are properties or characteristics of an entity. They provide detailed information about the entities and are represented within the column on the right below the name. Attributes can be simple or composite and can have different data types. Keys Represented in the left column below the name of the ERD. They either have PK (primary key) or FK (foreign key) Relationships Relationships represent the associations between entities. They indicate how entities are connected or related to each other. They are represented by crows feet, that connect one entity to another. Cardinality It defines the number of instances of one entity that can be associated with the instances of another entity. It specifies the relationship's multiplicity or how many entities participate in the relationship. 1:1, 1:M, M:N
48
what should you use to connect entities together in ER diagrams.
You should use the crows foot notation 1:1 ------------------------ 1:M -----------------------< M:N >---------------------<
49
what is data quality
It is a measure of the condition of data based on factors such as accuracy, completeness, consistency, reliability, and whether it's up to date.
50
what qualities does good data have?
- Data accuracy - Data completeness - Data authenticity - Data relevance - Data consistency - Data currency - Data cleaning
51
data accuracy: consequences of inaccurate data
1. Financial loss - incorrect transactions, missed opportunities and poor investments 2. Damage to reputation - can damage organisation's reputation 3. Poor-decision making - long-term consequences
52
data accuracy: identifying and fixing inaccurate data
1. Identify inaccurate data 2. Document inaccurate data 3. Fix inaccurate data
53
data accuracy: benefits of accurate data
1. Improved decision making 2. Increased efficiency 3. Enhanced reputation
54
data accuracy: best practices for ensuring accurate data accuracy
1. Implement data quality checks 2. Use data governance 3. Monitor data quality 4. Train staff
55
what is data completeness
is how much required data is included in a data set
56
what is data authenticity
the quality of data being genuine and unaltered since creation
57
what is data relevence
how useful and applicable data is for a specific task
58
what is data consistency
The absence of contradictions or conflicts between data values across different systems or data sets.
59
what is data currency
The degree to which data is up-to-date and reflects the most recent information available.
60
difference between data accuracy and data validity
Data accuracy - how well the data corresponds to the real-world. - focuses on correctness and truthfulness of data Data validity - degree to which data values are consistent with a defined domain. - focuses on whether the data falls within a given domain and adheres to defined rules
61
what is data profiling
Reviewing data from a source and summarising its details.
62
what is data matching
Comparing data from different sources to find duplicates or similarities.
63
what is data cleansing
Correcting inaccurate records in a database.
64
what are data quality tools
Software that helps maintain high data quality
65
what is data governance
Rules and responsibilities for managing data and information processes.
66
what is normalisation
process of identifying and eliminating data anomalies and redundancies. it is a set of 4 steps aimed at removing repeating data to improve data efficiency.
67
what are the rules of 1NF
1. columns must have single values 2. columns must have unique names 3. values of a given attribute must be the same data type 4. no two records or rows are identical
68
how do you get from 0NF to 1NF
1. identify multi-valued fields 2. create a second entity 3. identify primary key for the second entity 4. add a foreign key to the other table
69
what are the rules of 2NF
1. the table is in 1NF 2. there is no partial dependencies of any column on the primary key
70
what are the rules of 3NF
1. the table is in 2NF 2. all non-primary fields are dependent on the primary key
71
what is the schema
the table name and its attributes a key is an attribute that is unique
72
how to create a table in sqlite
CREATE TABLE name ( column1 DATATYPE, column2 DATATYPE, column 3 DATATYPE, );
73
how to link tables
CREATE TABLE parent_table ( id INTEGER PRIMARY KEY, name TEXT ); CREATE TABLE child_table ( id INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY (parent_id) REFERENCES parent_table(id) );
74
what are some common datatypes
- integer - real - text - blob - numeric - boolean - date - datetime
75
how to insert data
CREATE TABLE Purchase ( Product TEXT, PDate DATE, Price REAL, Quantity INTEGER ); INSERT INTO Purchase (Product, PDate, Price, Quantity) VALUES ('Bagel', '2021-10-21', 1, 20), ('Banana', '2023-03-10', 0.5, 10), ('Banana', '2023-10-10', 1, 10), ('Bagel', '2023-10-25', 1.5, 20);
76
the basic form of SELECT query
SELECT FROM WHERE
77
how to eliminate duplicates from SELECT query
SELECT DISTINCT FROM WHERE
78
how to SELECT using JOIN queries
SELECT PName, Price FROM Product, Company WHERE Manufacturer=CName AND Country=‘Japan’ AND Price <= 200
79
how to SELECT using aggregation queries
SELECT avg(price) FROM Product WHERE maker=“Toyota” SELECT count(*) FROM Product WHERE year > 1995
80
how to insert into a table
INSERT INTO R(A1,…., An) VALUES (v1,…., vn) INSERT INTO Purchase(buyer, seller, product, store) VALUES (‘Joe’, ‘Fred’, ‘wakeup-clock-espresso-machine’, ‘The Sharper Image’)
81
how to update a record
UPDATE customers SET contact_name = 'Fred Schmidt', phone_number = '042459823’ WHERE contact_name = 'Alfred Schmidt
82
how to delete a record
DELETE FROM PURCHASE WHERE seller = ‘Joe’ AND product = ‘Brooklyn Bridge’
83
what is the data lifecycle
1. collection 2. access 3. usage 4. storage 5. transfer 6. deletion & destruction
84
role of the privacy act
Collecting and analysing data can be useful for an organisation to promote productivity, growth, competition and innovation. The Privacy Act 1988, encompasses the protection of people’s personal information. There are 13 Privacy Principles under the Privacy Act. Personal information is information that identifies you or could identify you.
85
how to keep personal data private
Only provide data that is required when signing up to services Encrypt your data when sending across a network Backup your data Make your old computers' hard drives unreadable through destruction and/or data shredding Secure your wireless networks with latest Wi-Fi protection Use a robust firewall along with Anti-virus or anti-malware protection Encrypt data on your USB drives and SIM cards Disable file and media sharing if you don't need it Create encrypted volumes for local and portable drives Lock down your computers UEFI with a password Overwrite/shred deleted files Delete old files from cloud backups check and configure app privacy and permissions settings on your phone Configure privacy setting for online services Enable remote location and device-wiping Lock your smartphone, tablet, laptop and desktop devices
86
backups of data
Ensuring that critical data is backed up regularly is essential for keeping an organization up and running, no matter what happens. A backup plan is usually part of a disaster recovery plan (DRP) There are two broadly defined approaches to backup on-premises backup remote backup. In an on-premises setup, you can copy your data to a second hard drive, other media, or a shared drive, either manually or at specified intervals. This is then taken off-site at the end of the day In remote backup, your computer automatically sends your data to a remote center either as soon as modifications have been made to a file or at specified intervals.
87
types of backups
Full Backup - the most complete type of backup but is more time-consuming and requires more storage space than other backup options. Incremental backup - only backs up files that have been changed or newly created since the last incremental backup. This is faster than a full backup and requires less storage space. However, in order to completely restore all your files, you'll need to have the most recent full backup and all incremental backups since then available. And in order to recover a specific file, you may need to search through several incremental backups. Differential backup - backs up the files that have been changed or newly created since the last full backup. To recover the back, both the full backup and the differential backup are needed
88