Sunday, 19 May 2024

Introduction To DBMS & Relations

 Data:

As a base definition of data say that anything can be data.

But data is information such as facts and numbers used to analyse something or make decisions. Computer data is information in a form that can be processed by a computer.

Database:

A database is a collection of structured data stored in a computer that is easily approachable and manageable. The relevant purpose of the database is to operate a huge volume of information by storing, retrieving, and managing data.

 ------------------------------------------------------------------------------------------------


Database management systems:

There are following majorly types of database management systems which were using since 19th century.

FMS: File Management system:

Definition: it is used to work with text files. And the text files will be stored in file system or operating system. FMS is used to store, manage and to access the data from the text files.


Drawback of FMS:

1.       No security

2.       Concurrency is not possible

3.       Execution will be slow

 ----------------------------------------------------------------------------------------------------------

DBMS: Database management system

 

Definition:

it is used to store, manage and to access the data from database. In DBMS data will be stored in the form of tables. Every table will have two dimensions (Row and Column)

 

following are few examples of DBMS systems.

 

DBMS

FoxPro

Dbase

MS Access

 ----------------------------------------------------------------------------------------------

RDBMS: Relational database management system

 A relational database management system (RDBMS) is a program that allows us to construct, update, manage, and administer a relational database where data is in the form of tables consisting of rows and columns. Now the term relational signifies that there is a relationship that exists between values within each table. Tables within the same database can also be related to one another. Now at this point, it becomes very proximate to query the database and fetch relevant records from multiple tables.

 

The tables stored in database will have relation with one another. The common relation is parent and child relation (Parent tables and Child tables.)

 

  

     PROJECT                                         EMPLIST1

 

PID

PNAME

BUDGET

  1

HRMS

1000 Dollar

  2

CRMS

1500 Dollars

3

HMS

2000 Dollars

 

ENO

ENAME

PID

1001

ABHAY

1

1002

VARUN

1

1004

AMOL

1

 

 

 

  

 DEPARTMENT                                                                       EMP LIST

 

ENO

ENAME

SAL

DEPTNO

1001

ABHAY

19000

10

1002

VARUN

22000

10

1003

RAM

18000

20

1004

AMOL

20000

10

 

 

DEPTNO

DNAME

LOC

10

IT

HYD

20

SALES

HYD

 

 

 

 

  

DBMS Features: 

Redundancy can be reduced and inconsistency can be avoided

ENO

ENAME

SAL

DEPTNO

DNAME

1001

RAJ

9000

10

SALES

1002

SHIVAJI

12000

10

OPERATIONS

1003

RAM

8000

20

ACCOUNTS

Inconsistent data



Redundancy: means duplicate data or data repetition. Inconsistency means incorrect data or the data which is not meaningful. If table contains redundancy, then inconsistency may exist in tables. By using constraints redundancy cab be reduced and inconsistency can be avoided.

 Security:

A) Authentication and B) Authorization

Authentication means identification of user if it used to check whether the given name is already registered or not. After checking user name authorization will check the user has permissions or rights to work with database.

 Data Integrity: 

If the table maintaining the data integrity, then valid or meaningful data can be stored in tables. It is done by using constraints.

 

                             EMP

ENO

ENAME

DOJ

1001

RUPESH

31-FEB-09 10:47:00

 Atomicity: all the SQL commands in the transaction will execute or none of them will execute.

 

Transaction: set or sql commands will execute as a unit ACID Properties:

              A            -             Atomicity

              C            -             Consistency      

              I             -             Isolation            

              D            -             Durability

 

Consider that account A and account B are existing. The customer of a/c A wants to transfer Rs.5000 to account B using internet banking. If the transaction is completed successfully both the commands will execute.

 

Deduct 5000 from account A and add 5000 to account B. if the transaction fails then atomicity will check whether both the commands are executed or not. Out of two sql commands if one command is executed then atomicity will cancel the execution of the first sql command. In the given example two of the first SQL commands will execute or none of them will execute.


RDBMS Features:

 

01.         Large amount of data can be stored

02.         structural query language (SQL) or Sequel Sublanguages / subversions

              -             Data Manipulation language

              -             Data Definition language

              -             Data control language   

              -             Transaction Control language    

              -             Data Query language

3. Multiple tables cab be joined (joins) – inner joins and outer joins

4. Multiple relations can be created

    Relations: -     1:1, 1:M, M:1, M:M (1:M&M)

Project

 


Department – parent                                 

PID

PName

Budget

1

HRMS

1000 USD

2

CRMS

1500 USD

3

HMS

2000 USD

 

DeptNo

DName

LOC

10

IT

HYD

20

Sales

HYD

EMP List - child

EMP List

 

 


ENO

ENAME

SAL

DEPTNO

1001

ABHAY

18000

10

1002

RAM

19000

10

1003

AMOL

8000

20

1004

VINAY

22000

10

 

ENO

ENAME

PID

1001

ABHAY

1

1002

RAM

1

1003

VIKAS

2,3

 

Single value columns

Multi value columns

 

1:M       means one parent record in parent table will have relation with multiple child records in child table

M:1       means multiple parent records in parent table will have relation with one child record in child table.


 ---------------------------------------------------------------------------------------------