1.3 Exchanging data Flashcards
Why do we need to reduce the size of files
Data is sent more quickly
Less bandwidth is used
Buffering less likely to occur
Less storage is required
What are the two types of compression
lossy and lossless
What is lossless compression?
File size reduced without losing any original data
What is lossy compression?
Unneeded data permanently removed to lower file size. This data that is removed will be non noticable such as certain sound frequencies.
How does lossless compression work?
Records patterns in the data instead of the data instead to prevent recording redundant data
when should lossless compression be used
when no data can be lost for example a word document
examples of lossy compression
JPEG, MP3, MPEG
examples of lossless compression
ZIP
PNG
GIF
What are the two types of lossless compression
Run length encoding
Dictionary encoding
What is run length encoding?
Compression where conexcutive identical pieces of data are stored as one piece of data and a number representing length
What is dictionary compression
Spots regularly occuring data and stores it in a dictionary
How does dictionary compression reduce size
Repeated phrases are only stored once and are referenced with an identifier
What is encryption
The process of encoding a message so that it can be read only by the sender and intended recipient.
What is symmetric encryption?
An encryption method in which the same key is used to encrypt and decrypt a message
What is asymmetric encryption?
An encryption method in which two keys (one private, one public) are used to encrypt and decrypt a message. Such that someone with the public key can only encrypt and someone witht he private key can only decrpyt.
What is a one time pad
A one time key generated via random methods used for symmetric encryption
What is hashing
A one-way encryption an algorithm but no key
What are the uses of hashing
Storing passwords securly
Uniquely identify a file
What is a flat file database?
A database that consists of information on a single entity
What is an entity
A category of object, person, event or thing of interest about which data needs to be recorded
ther names for entities
Record, tuple
What is a relational database
Database that stores data points that are related to each other
What is a primary key
A field (or group of fields) that uniquely identifies a given entity in a table
What is a secondary key
Another field that can be used to identify an entity in a table
What is a foreign key?
A primary key of one table that appears as an attribute in another table and acts to provide a logical relationship between the two tables
How to write an entity description
EntityName(__PrimaryKey__, foreignKey, secondaryKey1, secondaryKey2)
What is a composite primary key?
A key made up of two primary keys from different tables
What is a one to one relationship
One entity is related to another single entity
What is a one-to-many relationship?
One entity is related to many entities
What is a many-to-many relationship?
Many entities a re related to many other entities
Diagram for one to one
Straight line between entities
Diagram for one to many
One ended 3 pronged pitch fork
Diagram for many to many
many
Two ended 3 pronged pitchfork
What are some manual methods of capturing data
Forms or surveys
What are some automatic methods of capturing data
Smart card readings
Barcode readers
Scanners
Optical character recognition
Optical mark recognition
Magnetic ink character regonition
Sensors
How can data be transferred to a databse
Automatically using DBMS software
By typing it in using a customised format
Importing from a spreadsheet or file
Using an EDI (Electronic Data Ingterchange)
What is an EDI
Computer to computer exchange of documents such as purchase orders
All documents must be in standard format
How do we select data in a database
Use SQL or similar to query data bases
What is database normalization
Process used to come up with the best possible design for a database
It avoids data duplication and inconsistency.
When is a database in first normal form
Contains no repeating attributes
All attributes must be atomic
When is a database in second normal form
It is in first normal form
It contains no partial dependencies
When is a database in third normal form
In second normal form
Contains no non key dependencies
Why is it important to be in third normal form
Easier to maintain data as integrity is preserved, so wen one piece of data is changed other instances of it a re changed
Searches are faster and less storage space is used due to no duplication of data
Easy to update data, due to fields only having to be added to one table as well as necessary data not being able to be deleted without being replaced
Example table creation sql
CREATE TABLE tblProduct
(
ProductID CHAR(4) NOT NULL PRIMARY KEY,
Description VARCHAR(20) NOT NULL,
Price CURRENCY
)
Alter table examples sql
ALTER TABLE tblProduct
ADD QtyInStock INTEGER
DROP QtyInStock
MODIFY COLUMN Description VARCHAR (30) NOT NULL
Linked table example sql
CREATE TABLE ProductComponent
(
FOREIGN KEY ProductID REFERENCES Product(ProductID),
FOREIGN KEY CompID REFERENCES Component(CompID),
PRIMARY KEY (ProductID, CompID) )
Insert into example sql
INSERT INTO Product (ProductID, Description, Price),
VALUES (“A345”, “Pink Rabbit”, 7.50)
Update example sql
UPDATE Product,
SET Description = “Blue Rabbit”, Price = 8.25,
WHERE ProductID = “A345”
Delete example sql
DELETE FROM Product
WHERE ProductID = “A345”
What is the default order for ORDER BY sql
Ascending
Select example sql
SELECT productID, productName, subject, price
FROM tblProduct
WHERE level = 4
ORDER BY productName
Between example sql
WHERE price BETWEEN 5.00 AND 10.00
In example sql
WHERE subject IN (‘Computing’, ‘Maths’)
LIKE example sql
WHERE subject LIKE “Comp*”
Selecting from multiple tables example sql
SELECT tblCustomer.custID, surname, tblProduct.productID, productName
FROM tblCustomer, tblProduct, tblSubscription
WHERE tblSubscription.custID = tblCustomer.custID AND tblSubscription.productID = tblProduct.productID
Join example sql
SELECT tblPlayer.surname, tblPlayer.firstname, tblTeam.teamName
FROM tblTeam, tblPlayer
JOIN tblPlayer
ON tblTeam.teamID = tblPlayer.teamID
WHERE team.teamName = “Binham”
What is transaction processing
The processing of several operations as part of a transaction (a single logical operation)
What is referential integrity
No foreign key in one table can reference a non existent record in a related table
Transaction processing example
Customer makes order:
may consist of several order line all of which must be processed
the quantity of each product adjusted on the stock fill
credit card details checked
payment accepted or rejected
What does ACID stand for?
Atomicity, Consistency, Isolation, Durability
What is ACID for
Ensures that the integrity of the database is maintained under all circumstances
It guarantees that transactions are processed reliably
What is Atomicity in ACID?
All or nothing principle
This property requires that a transaction is processed in its entirety or not at all
What is consistency in ACID
This property ensures that no transaction can violate any of the defined validation rules
Referential integrity, specified when the database is set up, will always be upheld