Database

Hello everyone!!

Data is collection of facts and figures anything visible to us or beyond our visualisation.

Database is a collection of related data, stored so that it is available to all different users for different purposes.

Database management system is a collection of programs that enables users to create and maintain a database.

Advantages of using DBMS:

  • Control redundancy.
  • Restricted unauthorized access.
  • Provide backup and recovery.
  • It keep information upto date.

Schemas and Instances

Description of database called DB schema, specified during DB design and not do change frequently.

The data in the DB at a particular moment in a time is called instance in the DB.

3 Schema Architecturedbm

Its a tool with which the user can visualise the scheme level in the DB.

Goal:  seperate user application and physical DB.

Internal level:  describe physical storage structure access path.

Conceptual level:

  • Describe the structure of whole DB for community of user.
  • Hides detail of physical storage structure and concentrates on describing entities, data types etc.

External level:

  • Includes external schema and user views.
  • Describe part of DB for particular user.

Normalizaton

Normalization is used for mainly two purpose:

  • Eliminating reduntant(useless) data.
  • Ensuring data dependencies make sense i.e data is logically stored.

Normalization Rule:

Normalization rule are divided into following normal form.

  1. First Normal Form
  2. Second Normal Form
  3. Third Normal Form
  4. BCNF

For details of these rule refer to this link.

http://www.studytonight.com/dbms/database-normalization.php

Concept of keys in DB

Keys are very important part of Relational database. They are used to establish and identify relation between tables. They also ensure that each record within a table can be uniquely identified by combination of one or more fields within a table.

Candidate key:

  • Set of fields from which primary key can be selected.
  • It is an attribute or set of attribute that can act as a primary key for a table to uniquely identify each record in that table.

Primary key:

  • Its a key that uniquely identify each record in a table.
  • It is a candidate key that is most appropriate to become main key of the table.

primary-key

NOTE: Difference between primary & unique key

  • Primary key- can never be null.
  • Unique key- can be null.

Super key:

  • If we add additional attributes to a primary key the resulting combination would still uniquely identify an instance of entity set is Super key.
  • It is a superset of Candidate key.

Composite key:

  • Key that consist of two or more attributes that uniquely identify an entity occurance is called Composite key.
  • But any attribute that makes up the Composite key is not a simple key in its own.

composite-key

Secondary or Alternative key:

  • The candidate key which are not selected for primary key.
  • Example- university_id : Primary key ; college_id: Secondary key

 

Thanks!!

 

 

 

 

 

 

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s