dbms assignment final

Upload: setu-desai

Post on 06-Apr-2018

236 views

Category:

Documents


2 download

TRANSCRIPT

  • 8/2/2019 DBMS Assignment Final

    1/36

    Database EnvironmentIntroduction-A DBMS is a data storage and retrieval system which permits datato be stored non-redundantly while making it appear to the user as if the data is well-

    integrated Store, retrieve and manipulate data.

    Wide Information system.

    Characteristics of the information

    Dynamic and time dependent,

    Various sources Enlarged

    Range of database application

    Personal data.

    Workgroup database.

    Departmental database.

    Enterprise database.

    There are many different types of Database systems; which are

    Oracle

    DB2

    MS Access

    Sybase

    My SQL

    Definitions-

    Data: Known facts that could be stored on the computer media like; text graphics, videos,

    sounds etc.

    Database: It is the organized collection of logically related data.

    Met data: Data that describes the characteristic of other data.

  • 8/2/2019 DBMS Assignment Final

    2/36

    Information: Data processed to be in useful decision making.

    File System vs. DBMS-

    Traditional File System:

    File system was developed to store data. It is also used today. And the other thing is it

    helps to understand database system. It is specially used to backup some of the database

    system. But there are many disadvantages in the file system. Below is the list of some of

    the disadvantages of this file system.

    Long development time: File system takes very long to develop the application. And

    there is very less opportunity to use the previous development efforts.

    Limited data sharing facility: There is very little opportunity to share data with other

    application.

    Duplication of data: Wasteful, loss of metdata integrity.

    Excessive data maintenance: The factors above show that the file system takes too

    heavy program maintenance load.

    Database Approach:

    A Database management System is a data storage and recovery system which permits data

    to be stored non-redundantly. DBMS is a large, integrated collection of data describing

    activities of any company or organizations. Below are the some properties of the DBMS;

    DATA is integrated, shared, self-described and constant.

    Different users need different kind of information and DBMS allows different type of

    data views to different users.

    DATA is self-determination in DBMS

  • 8/2/2019 DBMS Assignment Final

    3/36

    Some of the Advantages of the Database management system;

    Negligible data Redundancy.

    Improved data sharing.

    Improved data quality.

    Improved data quality.

    Data accessibility and responsiveness.

    Increased security.

    Enforcement standards.

    Less data maintenance.

    Increased productivity of data application.

    Backup/Recovery and data concurrency are accessible in DBMS.

    Components of Database Environment-

    1. CASE tools: These are the Computer Aided Software Engineering tools; they are

    used to design database and applications.

    2. Met data: Data that describes the properties or Characteristics of the other data. It

    includes data definition, data structures and rules or constrains. And the other thing

    is met data describes data it does not include data.

    3. Repository: It is an extended set of metadata for managing databases and other

    components of the information system. In other words we can say it is thecentralized storehouse of metadata.

    4. Database: An organized collection of logically related data. Or we can say it is an

    illustration of a collection of related data.

  • 8/2/2019 DBMS Assignment Final

    4/36

    5. Software: Data definition and data manipulation (DBMS) are the Software that is

    used to define, create, maintain and provide authorized access to the database and

    the store-house of it.

    6. User Interface: languages, menus etc by which users interact with the other system

    applications.

    Different types of database users-

    1. Database administrator (DBAs)

    Database Administrators are intended to

    Installing and upgrading the application tools and database server.

    Manage resources for data. Allocating system storage and planning future storage requirements for the database

    system

    Creating primary database storage structures.

    Creating primary objects like tables, views, indexes etc.

    Controlling and monitoring user access to the database.

    Backing up and restoring the database

    2. Database Designer

    Database designers are deliberated to

    Prepare database formation for application.

    Design and develop database application.

    Estimating storage requirements for an application.

    Tuning the application during development.

    Establishing security measures for an application during development.

    3. Application Programmer

    Application Programmers are intended to

    Develop and Implement requirements of end users.

    Interact with system through Data manipulation language.

  • 8/2/2019 DBMS Assignment Final

    5/36

    4. End user

    End users are anticipated to

    Use the application and database.

    Entering, modifying, and deleting data, where they are allowed to.

    Generating reports from database.

    Functionality provided by DBMS

    Views

    Security

    Concurrency

    Integrity

    Back up/Recovery

    Design

    Different t es of Com onents and users of

  • 8/2/2019 DBMS Assignment Final

    6/36

    Easy update.

    1. Views:

    Database management system has a facility of custom representation of data that

    correspond to the need of the class of the user. It provides representation of data for

    the different users to protect data quality.

    There are three kinds of views available in DBMS.

    1) Logical: User views (queries)

    2) Conceptual: Database administrators model for data( E-R diagrams)

    3) Physical: Actual Data structure(SQL statements)

    2. Security

    DBMS has some components that Limits data access to properly authorized users or

    programs and Protect data against accidental or intentional damage.

    3. Concurrency:

    There are some functions that prevent two users from interfering with each other

    when they use the same information.

    4. Integrity:

    This function protects the relationship among different related records in the database.

    5. Back up and recovery:

    This function processes to confirm and repeat the transaction so that we can recover

    the database after a problem.

    But this recovered database may be slow and it may provide us different result from

    the original at some times.

    Backu + Transa =Recovered

  • 8/2/2019 DBMS Assignment Final

    7/36

    6. Easy update:

    Updating the database is very easy in the database management system.

    DBMS in Commercial and Non Commercial ways

    DBMS is currently used by different users in commercial and non commercial environment.

    They use DBM system to maintain their data records in proper way. Different type of

    database management system can be structured according to there environment of using

    database.

    Database in non-commercial environment:They use databases to in non-commercial ways means they are not related to commercial.

    Following are the examples of non-commercial environment.

    1. Universities:

    They use DBMS to maintain information of the students, results, working staff, lectures,

    etc.

    2. Hospitals:

    In both government and private hospitals they use DBM system to keep the data of their

    patients, doctors, other staffs, surgery times etc. By using this system in hospitals they can

    serve their patients very easily like they can easily access the previous medical treatment

    of the patient and decide how to treat them.

    Database in commercial environment:

    They use the DBM system to keep the commercial record of their company. Bellow is the

    examples of the commercial environment.

    1. Manufacturing company:

    They use the suitable DBM system to store the information of the items that they

    produced information of the employ, the bills, income, etc.

  • 8/2/2019 DBMS Assignment Final

    8/36

    2. Banking:

    Bank is the most important place when we talk about the commercial environment. They

    use different types of database in bank. They use database to store the information like

    accounts, transaction, withdrawal, loans, mortgages etc.

    3. Airlines:

    They uses the system to store all the information about the tickets, passengers, luggage,

    food, employs etc.

    4. Telephone exchange:

    They use the DBM system to store all the detail of calls, numbers, billings, call charges etc.

    DBMS haS MaDe thiS all organizationS work so easy and fast. So DBM

    system is very important in all the commercial and non commercial

    environments.

    Fast-track train OrganizationBelow are the snapshots of the database of the fast track train organization.I have taken

    Trn for Train no, Cti for Customer Id and RSN for Reservation no. I have

    considered three trains for example in for this organization and five reservations in one

    train.

    We need to normalize our database. If we dont normalize the database there can be data

    redundancy or data duplication.

    Train

    no

    Train

    orig

    Train

    dest

    Dept

    time

    Arr

    time

    Train

    model

    Train

    cap

    Empl

    ID

    Emp

    role

    Emp

    name

    Cust

    no

    Cust

    name

    Cont

    no

    Cust

    add

    Cost Pay

    meth

    Resr

    no

  • 8/2/2019 DBMS Assignment Final

    9/36

    1st

    Normal Form

    Step-1: eliminate all the repeating groups

    Step-2: find a composite primary key.

    Primary key: Train no, Employee no, Customer ID

    Step-3: Identify all the dependencies

    Train no -> train origin city, Train Destination, Train departure time, Arrival time

    Train ID -> Model No, Train capacity

    Employee ID -> Emp name, Emp role, Emp contact no

    Customer ID -> Reservation no, cust name, cust contact, travelling date, payment method

    First of all this is the example of data that is without normalization progress. If we create

    data without normalization process that will create the duplication of data.

    2nd

    Normal Form

    Step-1: Identify all the key component.

    Train number, Employee ID, Customer ID

    Step-2: Identify all the dependent attributes.

    Train table:

    Train Number Train origin Train

    destination

    Train departure

    time

    Train arrival

    time

    Primary key: Train number

    Functional dependency:

    All the attributes are functionally dependent on the primary key

    Employee table:

    Emp no Emp role Emp name Contact no

    Primary key: Emp no

    Functional dependencies:

    Emp no -> emp role, emp name, contact no

    Transitive dependencies:

    Emp name -> Emp role, Contact no

    Train info table:

  • 8/2/2019 DBMS Assignment Final

    10/36

    Train ID Model no Train capacity

    Primary key: Train ID

    Functional dependencies: all the attributes are functional dependent on primary key.

    Cust- reservation table:

    Cust ID Resr no Train ID Cust

    name

    Journey

    date

    Cost Pay

    method

    Primary key: customer ID

    Functional dependencies:

    Cust ID -> Cust name, Cust contact, Travel date, cost, pay method

    Transitive Dependencies:

    Name -> Cust contact, Pay method, travel date.

    3rd

    Normal form

    Train table:

    Train no Train origin city Train dept city Train depr time Train arr time

    Primary key: Train number

    Functional dependency:

    All the attributes are functionally dependent on the primary key

    Employee table:

    Emp ID Emp name

    Primary key: Emp ID

    Emp Info table:

    Emp name Emp role Contact no

    Primary key: Emp name

    Functional dependencies: all the attributes are functionally dependent on primary key.

    Train info table:

    Train no Train model Train capacity

    Primary key: Train no

    Functional dependencies: all the attributes are functionally dependent on primary key.

  • 8/2/2019 DBMS Assignment Final

    11/36

    Cust Journey table:

    Cust Id Cust name

    Primary key: Cust ID

    Cust Info table:

    Cust name Travel date Cost Pay method Contact no

    Primary key: Cust name

    Functional dependencies: all the attributes are functionally dependent on primary key.

    Cust Train Table:

    Cust ID Train No Reservation No

    Primary key: Customer ID

    Functional dependencies: all the attributes are functionally dependent on primary key.

    The database shown above has no repeating groups. And as the database isnormalized till 3rd normal form there is no chance of data duplication or data

    redundancy. So we can put this database in action. After making this database I

    found it working properly and there is no data duplication. All the screen-shots

    are shown below:

    Un-normalized data (1)

    If we try to publish the data in this format MS-Access will not allow us to go ahead it will

    again and again give us the notification as above:

  • 8/2/2019 DBMS Assignment Final

    12/36

    Un-Normalized data (2)

    So we need to normalize the data up-to minimum of third normal form. Steps to normalize

    the data are described in the presentation slides below.

    Table 1: Train

  • 8/2/2019 DBMS Assignment Final

    13/36

    Table 2: Customer Id

  • 8/2/2019 DBMS Assignment Final

    14/36

    Table 3: Customer Info

  • 8/2/2019 DBMS Assignment Final

    15/36

    Table 4: Customer journey info

  • 8/2/2019 DBMS Assignment Final

    16/36

    Table 5: Reservation Train

  • 8/2/2019 DBMS Assignment Final

    17/36

    Table 6: Emp info

  • 8/2/2019 DBMS Assignment Final

    18/36

    Table 7: Emp Idtrain origin city da

    Table 8: Train info

  • 8/2/2019 DBMS Assignment Final

    19/36

  • 8/2/2019 DBMS Assignment Final

    20/36

    Table 9: Customer Reservation Table

    Below are the some outputs of Queries I have taken questions, SQL output screens and their Design views

    as well.

    Question 1: Find out the customers travelling in the train Trn1 with their reservation no and contact no

    Ans; output screen

  • 8/2/2019 DBMS Assignment Final

    21/36

    Design view:

  • 8/2/2019 DBMS Assignment Final

    22/36

    Question 2: Find out the full detail of customer whose reservation no is RSN1

    Ans: Output screen

  • 8/2/2019 DBMS Assignment Final

    23/36

    Design view:we have given the criteria of RSN1 in the customer reservation table so we have received the

    information of the customer whose reservation no is RSN1

  • 8/2/2019 DBMS Assignment Final

    24/36

    How to design a database?

    Below are the snapshots of the how to design a database?

  • 8/2/2019 DBMS Assignment Final

    25/36

  • 8/2/2019 DBMS Assignment Final

    26/36

  • 8/2/2019 DBMS Assignment Final

    27/36

  • 8/2/2019 DBMS Assignment Final

    28/36

  • 8/2/2019 DBMS Assignment Final

    29/36

  • 8/2/2019 DBMS Assignment Final

    30/36

  • 8/2/2019 DBMS Assignment Final

    31/36

  • 8/2/2019 DBMS Assignment Final

    32/36

  • 8/2/2019 DBMS Assignment Final

    33/36

  • 8/2/2019 DBMS Assignment Final

    34/36

  • 8/2/2019 DBMS Assignment Final

    35/36

  • 8/2/2019 DBMS Assignment Final

    36/36

    References:

    2.Relational database design clearly explained, (Jan L. Harrington),

    2002

    3.Database design, (Toby J Teorey, Stephen Buxton, Lowell Fryman,

    Terry Halpin), 2009

    4.Logical Database design Principles, (John Garmany, Jeff Walker, Terry

    Clark), 2005