Thursday, 4 June 2009

Concepts of Relational database system
To understand the basic concepts of RDBMS,the following information is provided to you.
Table is the place where you can save all your data in the relational model(RDBMS). Data is organized in terms of Rows and columns in a table. For Example, see the information we have here in employee table.
EMPLOYEE TABLE : (With out Relational Model)
-------------------------------------------------------------------------------------------------
EMPNO ENAME DEPTNO DNAME LOC SAL COMM
-------- ---------------------------------------------------------------------------------------
7000 KING 10 MARKETING DALLAS 5000.00 300.00
7001 ALEX 20 DEVELOPMENT NY 3500 100
7002 CHRIS 10 MARKETING DALLAS 4000 100
7003 STEVE 20 DEVELOPMENT NY 4000 200
7004 KELLY 30 HR LA 2000 50
7005 JONES 30 HR LA 1700 40
In the above example,we have 6 employee records. 2 employees for each department.Take a look at it and see how many times we have the same information ie duplicate information.The departments are occuring twice and so more memory space is occupied. To calculate this,
MARKETING 9 BYTES
DEVELOPMENT 10 BYTES
HUMAN RESOURCES 9 BYTES
DALLAS 6 BYTES
NY 2 BYTES
LA 2 BYTES
TOTAL 28 BYTES
For 6 records we wasted 26 bytes, Imagine having 5000 employees working in thecompany! Then we are wasting 28 * 5000 bytes = 140000bytes,which is around 13 MB of memory.
Advantages of the new system(Relational model):
If you split the above shown data into two different tables then it becomes easy to maintain the data, For example:- If a particular department moved from Dallas to Atlanta,we need to change the city table for deptno 10 in the new system where as in the previous system we have to update all the employee records whose department is deptno 10.
removes the duplicate information (Data Redundancy) instead of duplicating the Department name and Location for every employee record as seen in the previous system,You can see Department name and Location only once in the Department table based on the common column in the new system .
Reduces the Memory space in the database
Employee Table
EMPNO ENAME DEPTNO SAL COMM

7000 KING 10 5000 300
7001 ALEX 20 3500 100
7002 CHRIS 10 4000 100
7003 STEVE 20 4000 200
7004 KELLY 30 2000 50
7005 JONES 30 1700 40
Department Table
DEPTNO DNAME LOC
10 MARKETING DALLAS
20 DEVELOPMENT NY
30 HUMAN RESOURCES LA
We have the same information now as before but the difference is we have two tables instead of one table.To relate the two tables, we need a common column between the tables. In the above example, there is a common column (DEPTNO).
Introduction to RDBMS
DBMSConcepts of RDBMS:This part gives you details about the basic concepts like how the data is viewed in Relational Database management system and advantages of RDBMS over other systems.
Codd's rules: defines the relational completeness of a DBMS.
Primary keys: Any column or a set of columns that uniquely identify rows of a Table.
Entity integrity: The primary key of a table should not be partially or wholly NULL.
Referential integrity: No foreign key value may reference primary key that does not exist.
Normalization: It is a technique that logically groups the data over a number of tables, which are independent and contain no unnecessary data.
Structured Query language(SQL): It is a high level, set oriented, interactive database language for RDBMS. Used for definition and manipulation of database objects.

Tuesday, 2 June 2009

Introduction to DBMS

Database Management System

is a software package where you maintain and control the information to run the business and to do the day to day operations in an organized and user friendly method. In the DBMS we can back up the data, implement the security so that certain information can be modified or viewed by certain people working in the organization. In this section we learn the main concepts which we must follow while working in DBMS.
In simple words, a Database Management System is a Software program which makes the task easier, the task being adding, deleting, modifying and maintain theinformation.
Here are some database terms and concepts.
Database Concepts
Data
Databases
Entity, Attribute and Data
Entity Relationships
Data Models
DataData is information about some thing. Data gets differed from business to business,FOR EXAMPLE:- For a bus transportation company BUS, DRIVERS, CITY, SEATS OCCUPIED are data, for a computer hardware company MONITOR, CPU, HARD DISK are data.
DatabasesDatabase is an area where you save the data needed to run the business. Database provides the following features like Sharing Data,enforcing Business rules,Data security which can be applied centrally
Entity, Attribute and DataAn Entity is an object which has some attributes, FOR EXAMPLE:- A employee in an organization has a name and a particular Job.Here EMPLOYEE is an ENTITY, NAME and JOB are ATTRIBUTES. Entity - EMPLOYEEAttribute - EMP_NAME and JOBData - Name of Employee like (Mike Modano) , his Job is like (Marketing).
Entity RelationshipsDatabase contains many Entities (Tables), we can relate an entity to another,FOR EXAMPLE:- In an organization we have many departments and many employees working , here we have two entities one is EMPLOYEE and the other is DEPARTMENT. So how do we relate these two entities?We can RELATE these two entities as:-In one department there can be many employees.
The relationship between two different entities can be classified as:
1.ONE to ONE example PERSON - PASSPORT ( one individual can have only one passport)
2.ONE to MANY example DEPARTMENT - EMPLOYEE ( In one department there can be many employees working)
3.MANY to MANY example DOCTOR - PATIENT ( A doctor can have many patients and a patient can have many doctors )