Saturday, 13 December 2014

Database Management System-Introduction TO DATABASE

Outlines

  • File Systems
  • Database Management Systems
  • Purpose of Database Systems
  • Database Objects
  • Insert data into table
  • Database Constraints
File systems
File System has duplication
File can not be centralized resource
File can not be used as distributed computing.
Apply constraint strategy is too difficult.
Database Management System
DBMS contains information about a particular enterprise

Collection of tables
An environment that is both convenient and efficient to use
Database Applications

Banking: all transactions

Airlines: reservations, schedules

Universities:  registration, grades

Sales: customers, products, purchases

Online retailers: order tracking, customized recommendations

Manufacturing: production, inventory, orders, supply chain

Human resources:  employee records, salaries, tax deductions
Purpose of Database Systems

Database is solution of all drawbacks
Drawbacks of using file systems to store data:
  Separation and isolation of data
  Duplication of data.
           Data dependence.  
Database Objects  
How to create database
How to create the tables
How to create fields , records
Example:
Create database dem0;
Examples:
Create database demo;
Use demo
Create table emp(id int, name varchar(100))
 

Insert the data into table   

Insert into emp values(1,’admin’)
Insert into emp values(1,’ali’)
Allow the duplication
Database Constraints 
To prevent invalid data entry into tables..
1.Primary key
2.Not Null
3.Check
4.Unique
5.Foreign Key
 
Constraint Description
NOT NULL: Specifies that the column cannot contain a null value 
UNIQUE: Specifies a column or combination of columns whose values must be unique for all rows in the table.
PRIMARY KEY: Uniquely identifies each row of the table
FOREIGN KEY: Establishes and enforces a foreign key relationship between the column and a column of the referenced table
CHECK: Specifies a condition that must be true
Example:
sql management studio query

Create table persons

(p_id int primary key,

first_name varchar(100) not null,

Last_name varchar(100),

Adress varchar(255) unique,

Check(p_id>0))
 

1 comments:

Good post about Database management system..
Shoofi

Post a Comment