Database and DBMS

29
Database and DBMS

description

Database and DBMS. Why?. Databases can be considered as electronic filing systems. Computing power and amount of data is increasing . How do you convert all that data to useful information , tailored to your needs. Data vs information. Data + Structure = Information. - PowerPoint PPT Presentation

Transcript of Database and DBMS

Page 1: Database  and DBMS

Database and DBMS

Page 2: Database  and DBMS

Why?

• Databases can be considered as electronicfiling systems.

• Computing power and amount of data isincreasing.

• How do you convert all that data to usefulinformation, tailored to your needs.

Page 3: Database  and DBMS

Data vs information

Data+

Structure=

Information

Page 4: Database  and DBMS

Miniworld

• A database represents some aspect of thereal world, sometimes referred toas miniworld.

• Changes in the miniworld are reflected inthe database.

Page 5: Database  and DBMS

Simple Data.

• Simple Data → Simple Information.• E.G. Dates of Birth of your family members.– Such information can be stored in memory.• Dates of Birth of your family, friends, co-workers.– Can be stored on a piece of paper or flat text files.• The Data here is simple, and information providedis straight forward, there is no need for a complexdatabase.

Page 6: Database  and DBMS

Complex Data.

Information on Gene X.• Protein• Species• Polymorphisms• More Proteins• Attributes

Page 7: Database  and DBMS

Flat File Approach

• Data can still be stored in flat files.• May even work for single/small number of users.• Consistency issues.

– No apparent relationships between different files/data.– No fixed protocols for data access.– Data integrity & duplication.

• Data structure is rigid – makes it difficult tochange or update.

Page 8: Database  and DBMS

Definition of Database.

• A shared collection of logically related data(and a description of this data) designed tomeet the information needs of an

organisation.– Data is shared.– Collection.– Logically related (Entity relationship model –

ER).

Page 9: Database  and DBMS

Real World Applications

• Applications in the real world are usually rich inconcepts and there are various associations among these concepts.

• University Academic System– Courses– Faculty Allocated– Classes– Students– Schedule

• Association between these concepts.

Page 10: Database  and DBMS

Terminology

• Entity: an object or a concept from the real world• Entity set: a collection of entities• Attribute: a property of an entity• Relation: a “table” with columns and rows• Tuple: a row in a table• Relationship: an association between two or more

entities• Database: a set of tables for entity sets and relationships• Rel. Database: a collection of normalized tables

Page 11: Database  and DBMS
Page 12: Database  and DBMS

Primary and Foreign Keys

• The primary key is the candidate key that isselected to identify entities uniquely within the relation

• A foreign key is an attribute or a set of attributes that matches the candidate key of some relation.

Page 13: Database  and DBMS

Some Biological Databases1. DDBJ (DNA Data Bank of Japan)2. EMBL Nucleotide DB (European Molecular Biology Laboratory)3. GenBank (National Center for Biotechnology Information)4. UniProtKB (Universal Protein Resource Knowledgebase)5. Swiss-Prot Protein Knowledgebase (Swiss Institute of Bioinformatics)6. PROSITE Database of Protein Families and Domains7. Protein Data Bank (PDB) (Research Collaboratory for StructuralBioinformatics (RCSB))

Ref:http://en.wikipedia.org/wiki/Biological_database#Example_public_databases_for_molecular_biology and look through various database examples.

Page 14: Database  and DBMS

Problem 1

• A program is required to prompt the terminal operator for the maximum and minimum temperature readings on a particular day, accept those readings as integers, and calculate and display to the screen the average temperature, calculated by (maximum temperature + minimum temperature)/2.

Page 15: Database  and DBMS

• Defining diagram

Input Processing OutputMax_tempMin_temp

Prompt for temperaturesGet temperaturesCalculate average temperatureDisplay average temperature

Avg_temp

Page 16: Database  and DBMS

Solution Pseudocode

Begin programPrint Get inputs #command for prompt

Get max_temp, min_temp #command for inputs

avg_temp= (max_Temp + min_temp)/2 # command for airthmetic process

Print Output avg_temp #command for

output End Program

Max_temp Min_temp Avg-temp

52 25 X

Page 17: Database  and DBMS

Problem 2

• Calculate the circumference and area of a circle

Page 18: Database  and DBMS

• Defining diagram

Input Processing OutputRadiuspi

Get radius, piCalculate circumference = 2 * P I* radiusCalculate area=PI * radius ^ 2Display circumference, area

Circumference

area

Page 19: Database  and DBMS

Solution PseudocodeBegin program

get radius, PI circumference = 2 * P I* radius

area=PI * radius * radiusdisplay circumference, area

End program

radius pi cumference = 2 * P I* radius

area=PI * radius * radius

5 3 2*3*5=30 3*5*5=75

Page 20: Database  and DBMS

Problem 3

• an increment program with increment of 3, max=10, min=1

Page 21: Database  and DBMS

• Defining diagram

Input Processing Outputimaximinincrement value

Get imax, Imin, increment value

Run for loop max times using increment operator

Display values for increment

imin

Page 22: Database  and DBMS

Solution PseudocodeBegin program

for ( i=1; i<=10; i+3) display i

i+3End program

i (display) i=i+3 Condition check(i<=10)

1 1+3=3 3<=10 Y

3 3+3=6 6<=10 Y

6 6+3=9 9<=10 Y

9 9+3=12 12<=10 N

Page 23: Database  and DBMS

Problem 4

• a decrement fire program with user given values for increment, max, & min operator

Page 24: Database  and DBMS

• Defining diagramInput Processing Output

imaximindecrement value

Prompt for input of imax, Imin, decrement value

Get imax, Imin, decrement value

Run for loop max times using decrement operator

Display values for decrement

Display „FIRE“.

imax

Page 25: Database  and DBMS

Solution PseudocodeBegin programPrint “Take value of” i, x, y

for ( i; i>=x; i-y) display i

i-yPrint “FIRE”End program

(output)i=10

i-yWhere y=1

Condition check(i>=5)

10 10-1=9 9>=5 Y

9 10+1=8 8>=5 Y

8 10+1=7 7>=5 Y

7 10+1=6 6>=5 Y

6 10+1=5 5>=5 Y

5 10+1=4 4>=5 N

FIRE

Page 26: Database  and DBMS

Problem 5

• Given a user value tell the integer status in terms of being positive or negative

Page 27: Database  and DBMS

• Defining diagram

Input Processing OutputX Prompt for input of x

Getx

If (x<0) diaplay „user entered a negative integer“ Elseif (x>0) diaplay „user entered a positive integer“ Else display „user has entered a zero“

Assesment

Page 28: Database  and DBMS

Solution PseudocodeBegin program

Print “Take value of” xGet x

If (x<0)diaplay “user entered a negative integer”

Elseif (x>0)

diaplay ”user entered a positive integer” Elseif(x==0)

display “user has entered a zero“

End program

x Condition

check(x<0)

Condition

check(x>0)

Condition

check(x=0)

Output

10 10<0N

10>0 Y

Not checked

user entered a positive integer”

Page 29: Database  and DBMS

GOOD LUCK