Data and its manifestations. Storage and Retrieval techniques.

38
Data and its manifestations. Storage and Retrieval techniques.

Transcript of Data and its manifestations. Storage and Retrieval techniques.

Page 1: Data and its manifestations. Storage and Retrieval techniques.

Data and its manifestations.

Storage and Retrieval techniques.

Page 2: Data and its manifestations. Storage and Retrieval techniques.

What is Data NumbersTextSentencesFilesImagesAudio files

Page 3: Data and its manifestations. Storage and Retrieval techniques.

One way to store data Columns and Rows of data can easily be

entered

Disadvantages Difficult to look for data Security Multiple files are not related to each other

Excel File

Page 4: Data and its manifestations. Storage and Retrieval techniques.

Data Redundancy

Data Inconsistency

Excel File

Page 5: Data and its manifestations. Storage and Retrieval techniques.

Bit

Byte

Field

Record

File

Database

Hierarchy of Data

Page 6: Data and its manifestations. Storage and Retrieval techniques.

Primary Keys

Secondary Keys (Alternate Keys)

Foreign Keys (will understand better with reference to a database)

What are Keys

Page 7: Data and its manifestations. Storage and Retrieval techniques.

Master Files permanent source, data of a permanent nature, data which will change every day

Transaction Files used to update a Master, batch processing

Serial and Sequential Files

Page 8: Data and its manifestations. Storage and Retrieval techniques.

Serial

Sequential

Indexed Sequential

Direct Access (random)

Types of File Organization

Page 9: Data and its manifestations. Storage and Retrieval techniques.

SERIAL

Just add records as they come in.Used for Transaction files.

Discuss why ?

Types of File Organization

Page 10: Data and its manifestations. Storage and Retrieval techniques.

SEQUENTIAL

Add records one after another but in key sequence

Used for master filesDiscuss why ?

Types of File Organization

Page 11: Data and its manifestations. Storage and Retrieval techniques.

Direct Access Files

Store the record at an address which is calculated using a reference to the Primary

Key

Types of File Organization

Page 12: Data and its manifestations. Storage and Retrieval techniques.

Add a record to a Serial File

Open fileAppend record to end of file

Algorithms

Page 13: Data and its manifestations. Storage and Retrieval techniques.

Add a record to a Sequential File

1. Open old file for reading2. Open new file for writing3. Start from beginning of old file4. Repeat

1. Read next record2. If current record key > new record key3. write new record to file4. End if5. Write current record to new file Until EOF

5. If new record is not yet inserted then write new record to new file.

Algorithms

Page 14: Data and its manifestations. Storage and Retrieval techniques.

Delete a record from a Serial or Sequential file

1. Open old file for reading2. Open new file for writing3. Repeat (read from old file)• Read next record• If current record key <> key of record to be deleted • then write record to the new file• End if Until End Of File

Algorithms

Page 15: Data and its manifestations. Storage and Retrieval techniques.

Search for a record with a particular key

Serial File

Open FileRepeat (start reading) Test for matchUntil EOF or match is made

Algorithms

Page 16: Data and its manifestations. Storage and Retrieval techniques.

Search for a record with a particular key

Sequential File

Open FileRepeat (start reading) Test for matchUntil match is found or key of this record > key of wanted record

Note : Here once the key passes the key of the wanted record the record can be deemed as not found. Because the records are sorted sequentially

Algorithms

Page 17: Data and its manifestations. Storage and Retrieval techniques.

Update Sequential Master file with Transaction records

Open a new file and add all records in Seq file to new file until the first sequential transaction record comes up. Now write the transaction record into the new file. Continue the process and write all other records from sequential file and transaction file.

Logic

Page 18: Data and its manifestations. Storage and Retrieval techniques.

Update a Sequential Master File

Open master file for readingOpen transaction file for readingOpen new master file for writingRepeat (transaction file records) While master record key < transaction record key Write master record to new master file End While (Read next master record) Write transaction record to new master fileUntil EOF (transaction)Repeat (master file records) Write master record t new master fileUntil EOF (master)

Algorithms

Page 19: Data and its manifestations. Storage and Retrieval techniques.

Also called Hash, Random or Relative files.

One hash algorithm could be:Every record has a key. Take the key and divide by total number of records. The remainder is the address where I will store the record.

Direct Access Filehow records are stored

Page 20: Data and its manifestations. Storage and Retrieval techniques.

This can cause synonyms or collisions.

One way to resolve a collision is if there is one, store the record at the next available memory address. When highest address is reached, wraparound and store at address 0.

Direct Access Filemanaging a collision

Page 21: Data and its manifestations. Storage and Retrieval techniques.

Another method is have a separate area to store these “collision affected” records.

Mark the new address at the original address location.

Direct Access Filemanaging a collision

Page 22: Data and its manifestations. Storage and Retrieval techniques.

Should retrievals be fast ?Should information be upto date or not necessary ?Can information be batched ?Are reports needed to be in order ?What happens when information is lost or destroyed ?

What kind of Files to use and When?

Page 23: Data and its manifestations. Storage and Retrieval techniques.

It is the proportion of records being accessed in any one run.

It is calculated by dividing the number of records accessed by the total number of records on file expressed as a percentage.

If hit rate is low, direct access is better. If high sequential is ok.

Payroll processing has high hit rates, Updating address has low hit rate.

Hit Rate

Page 24: Data and its manifestations. Storage and Retrieval techniques.

Data Security is keeping data safe from the various hazards to which it may be subjected.

Protection against loss, corruption, or unauthorized access to data.

Data Security

Page 25: Data and its manifestations. Storage and Retrieval techniques.

1. Use of passwords2. Immediate removal of employees who have

been handed the pink slip/sacked.3. Educating staff on ways data can be

breached.4. Separation of duties and having different

access levels.5. Appointing a security manager.

How to keep data secure

Page 26: Data and its manifestations. Storage and Retrieval techniques.

Keep passwords and user ids in a safe place – database tables.

Keep passwords encrypted.

Passwords should not be displayed on screens or on printouts. They should be suppressed.

User Ids and Passwords

Page 27: Data and its manifestations. Storage and Retrieval techniques.

Data encryption is done so that data transmitted to remote locations is secure from hackers and wire tappers.

There is no limit to damage that can occur should tapping happen and security of data is hampered in any way or form.

There are many encryption algorithms available including use of encryption keys.

Encrypting data

Page 28: Data and its manifestations. Storage and Retrieval techniques.

What do you mean by Access Rights---Right to see some or all information

Access Rights is implemented by having a leveled structure in security where people of a certain level can see certain data/even certain fields.

Access Rights

Page 29: Data and its manifestations. Storage and Retrieval techniques.

Needed to prevent loss of data due to a disaster

Protects against power failures, theft, viruses

Backup recovery should be properly tested before implementation

Sometimes replication is implemented in an organization to keep backups up to date

Backups taken on disks are transferred to remote locations to prevent major disasters

Backups

Page 30: Data and its manifestations. Storage and Retrieval techniques.

The difference between archiving and backing up should be clear.

What is Archiving ?

Archiving

Page 31: Data and its manifestations. Storage and Retrieval techniques.

A binary digit (1 or 0) is known as a bit.

8 bits make up a byte.

One character can be represented as one byte.

Data Representation

Page 32: Data and its manifestations. Storage and Retrieval techniques.

How do I represent 102 in decimal as a binary

64 32 16 8 4 2 1

Put in a 1 where possible and rest as zeroes starting from right 64 32 16 8 4 2 1 1 1 0 0 1 1 0

Denary to Binary number conversion

Page 33: Data and its manifestations. Storage and Retrieval techniques.

Consider 1 1 0 0 1 1 0

Start from right and represent each digit as 2,4,8 and so on

Multiply place position with 1 or 0 as case maybe and add the numbers together

Binary to Denary

Page 34: Data and its manifestations. Storage and Retrieval techniques.

Raw data is a collection of numbers and characters stored in a particular way so as to be able to read it later.

Information is what can be derived from the stored data. A communication that provides understandable and useful knowledge to the recipient.

Data and Information

Page 35: Data and its manifestations. Storage and Retrieval techniques.

4 bit representation of a decimal digit

Eg : 20 in BCD would be0010 0000

Advantage : Easier to convert. Just split into groups of 4 and convert to decimal.In BCD arithmetic rounding of fractions does not occur. In normal binary arithmetic some kind of rounding off occurs.

What is BCD Binary Coded Decimal

Page 36: Data and its manifestations. Storage and Retrieval techniques.

1. More bits are required to store a number2. Calculations with this is more complex than

ordinary binary.3. Consider adding 1 and 190000 00010001 10010001 1010 is not correct. 1010 is not a valid BCD.

Disadvantages of BCD

Page 37: Data and its manifestations. Storage and Retrieval techniques.

This problem occurs because 9 is represented as 1001 after which the next 6 binary numbers are unused. So we need to add 6 to this result.

0001 10100000 01100010 0000 which is 20 which is the correct result

Disadvantage of BCD

Page 38: Data and its manifestations. Storage and Retrieval techniques.

End of DATA and its

REPRESENTATIONS