Pages

Wednesday, July 6, 2011

Basics of DBMS

Data Base Management System:
        DBMS are collection of tools to manage databases. The four basic functions performed by all DBMS are
            1. Create, Modify, Delete data structures, e.x. tables
            2. Add, Modify, Delete data.
            3. Retrieve data selectively.
            4. Generate reports based on data.

Database:
       A database is a collection of related tables. It can also include other objects like queries, forms and reports. The structure of database is the relationships between its tables.

Components of Database:
       Databases are composed of related tables, which in turn are composed of fields and records.
Field:
       Field is an area( within a record) reserved for a specific piece of data.
       Fields are defined by
               - Field name
               - Data type
               - Field size.
Record:
       It is the collection of values for all the fields pertaining to one entity.
Table:
       It is a collection of related records. In a table records are represented as rows and fields are represented as columns.

Relationships:
       There are 3 types of relationships which can exist between tables:
              - One to One
              - One to Many
              - Many to Many
        Most common relationships in a relational database are One to Many and Many to Many
        Example of One to Many - Customer table and Order table. Each order has only one customer, but a customer can take many orders. They contain 2 tables - the "one" table and "many" table
        Example of Many to Many -  Order and Purchase tables.An order can contain many products and a product can be on many orders. They contain 3 tables.two "one" tables, both in One to Many relationship with the third table.

Database Normalization:
       Normalization is the process of efficiently organizing data in a database.
Goals:
       - Eliminating redundant data
       - Ensuring data dependencies make sense.

Normal Forms:
       The database community has developed a series of guidelines for ensuring that databases are normalized. These are referred to as normal forms and are numbered from one through five.
First Normal Form:
        - Eliminates duplicate columns from the same table.
        - Create separate table for each group of related data and identify each row with a unique column or set of columns (Primary key).
Second Normal Form:
        Address the concept of removing duplicate data.
        - Should be in first normal form.
        - Remove subsets of data that apply to multiple rows of a table and place them in separate tables.
        - Create relationships between these new tables and their predecessors through the use of foreign keys.
Third Normal Form:
        - Meet all requirements of second normal form.
        - Remove columns that are not dependent on the primary key.

No comments:

Post a Comment