DBMSNotes

Embed Size (px)

Citation preview

  • 7/27/2019 DBMSNotes

    1/8

    DATABASE MANAGEMENT SYSTEM

    A Database is a well defined collection of data. A Database Management

    System (DBMS) is a set ofcomputer programs that controls the creation, maintenance,

    and the use of the database in a computer platform or of an organization and its end users.

    It allows organizations to place control of organization-wide database development in the

    hands ofdatabase administrators (DBAs) and other specialists. A DBMS is a system

    software package that helps the use of integrated collection of data records and files

    known as databases. It allows different user application programs to easily access the

    same database. DBMSs may use any of a variety ofdatabase models, such as the network

    model orrelational model.

    In large systems, a DBMS allows users and other software to store and retrieve

    data in a structured way. Instead of having to write computer programs to extract

    information, user can ask simple questions in a query language. Thus, many DBMS

    packages provide Fourth-generation programming language (4GLs) and other application

    development features. It helps to specify the logical organization for a database and

    access and use the information within a database. It provides facilities for controlling data

    access, enforcing data integrity, managing concurrency controlled, and restoring

    database.

    DATABASE well defined collection of data

    MANAGEMENT

    SYSTEM software

    In short, DBMS is a SOFTWARE that performs the MANAGEMENT operations

    (SELECT, DELETE, INSERT and UPDATE) on a well defined collection of data.

    1

    SELECT

    UPDATE

    DELETE

    INSERT

    DBMS

    http://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Databasehttp://en.wikipedia.org/wiki/End_userhttp://en.wikipedia.org/wiki/Database_administratorhttp://en.wikipedia.org/wiki/Database_administratorhttp://en.wikipedia.org/wiki/Database_modelhttp://en.wikipedia.org/wiki/Network_modelhttp://en.wikipedia.org/wiki/Network_modelhttp://en.wikipedia.org/wiki/Relational_modelhttp://en.wikipedia.org/wiki/Data_structurehttp://en.wikipedia.org/wiki/Query_languagehttp://en.wikipedia.org/wiki/Fourth-generation_programming_languagehttp://en.wikipedia.org/wiki/Data_accesshttp://en.wikipedia.org/wiki/Data_accesshttp://en.wikipedia.org/wiki/Data_integrityhttp://en.wikipedia.org/wiki/Computer_programhttp://en.wikipedia.org/wiki/Databasehttp://en.wikipedia.org/wiki/End_userhttp://en.wikipedia.org/wiki/Database_administratorhttp://en.wikipedia.org/wiki/Database_modelhttp://en.wikipedia.org/wiki/Network_modelhttp://en.wikipedia.org/wiki/Network_modelhttp://en.wikipedia.org/wiki/Relational_modelhttp://en.wikipedia.org/wiki/Data_structurehttp://en.wikipedia.org/wiki/Query_languagehttp://en.wikipedia.org/wiki/Fourth-generation_programming_languagehttp://en.wikipedia.org/wiki/Data_accesshttp://en.wikipedia.org/wiki/Data_accesshttp://en.wikipedia.org/wiki/Data_integrity
  • 7/27/2019 DBMSNotes

    2/8

    EXAPMLE FOR A BATABASE AND THE OPERATIONS

    Let MANAGEMENTSTUDIES be the database. A database can have any number of

    files in it. So ourMANAGEMENTSTUDIES database has three files namely

    1. student

    2. teachingstaff

    3. nonteachingstaff

    Let us consider only the student file now. The files in the database are arranged in the

    form of a table containing row and columns and the data will be arranged in these rows

    and columns.

    The student database file will look like this:

    Roll. No Name Age AttendancePercent MarkPercent

    1 Anish 20 70 70

    2 Eby 21 80 80

    3 Archana 20 90 90

    4 Dhanya 20 78 80

    5 Chinchu 20 90 80

    6 Feby 23 80 70

    7 Jain 26 50 50

    8 Meenu 23 70 89

    9 Arun 23 60 68

    10 Robin 22 90 85

    Now let us see how we can perform the Management operations on the above database

    file:

    2

    student

  • 7/27/2019 DBMSNotes

    3/8

    1. Retrieval or Selection from the database file:

    The selection or retrieval from a database is possible with the help of the SELECT

    command. Its syntax is as follows:

    Example:-

    SELECT Roll. No, Name, Age

    FROM student

    WHERE MarkPercent>80

    Result:

    Roll. No Name Age

    2 Eby 21

    3 Archana 20

    4 Dhanya 20

    5 Chinchu 20

    8 Meenu 23

    10 Robin 22

    2. Inserting a new data into the student database file

    3

    SELECT

    FROM name of the database file

    WHERE condition

  • 7/27/2019 DBMSNotes

    4/8

    The insertion into a database file is possible with the help of the INSERT command.

    Its syntax is as follows:

    Example:-

    INSERT INTO student (Roll. No, Name, Age, AttendancePercent, MarkPercent)

    VALUES (11, Subin, 23, 79, 60)

    Result:

    Roll. No Name Age AttendancePercent MarkPercent

    1 Anish 20 70 70

    2 Eby 21 80 80

    3 Archana 20 90 90

    4 Dhanya 20 78 80

    5 Chinchu 20 90 80

    6 Feby 23 80 70

    7 Jain 26 50 50

    8 Meenu 23 70 89

    9 Arun 23 60 68

    10 Robin 22 90 85

    11 Subin 23 79 60

    3. Updating data in the student database file

    4

    INSERT INTO name of the database file (fields to be inserted)

    VALUES (values to be given for the field we are inserting)

    student

  • 7/27/2019 DBMSNotes

    5/8

    Updating a database is possible with the help of the SELECT command. Its syntax is

    as follows:

    Example:-

    UPDATE student

    UPDATE student

    SET AttendancePercent =90

    WHERE MarkPercent>80

    Result:

    Roll. No Name Age AttendancePercent MarkPercent

    2 Eby 21 90 80

    3 Archana 20 90 90

    4 Dhanya 20

    90

    80

    5 Chinchu 20

    90

    80

    8 Meenu 23

    90

    89

    10 Robin 22

    90

    85

    4. Deleting data from the student database file

    The deletion from a database is possible with the help of the DELETE command. Its

    syntax is as follows:

    5

    UPDATE name of the database file

    SET write the updation that is to be made on the existing database file

    WHERE condition

    student

    DELETE

    FROM database file name

    WHERE condition

  • 7/27/2019 DBMSNotes

    6/8

    Example:-

    DELETE FROM student

    WHERE Roll. No = 5

    Result:

    Roll. No Name Age AttendancePercent MarkPercent

    1 Anish 20 70 70

    2 Eby 21 80 80

    3 Archana 20 90 90

    4 Dhanya 20 78 80

    6 Feby 23 80 70

    7 Jain 26 50 50

    8 Meenu 23 70 89

    9 Arun 23 60 68

    10 Robin 22 90 85

    11 Subin 23 79 60

    6

    student

  • 7/27/2019 DBMSNotes

    7/8

    DDL

    Data Definition Language (DDL) statements are used to define the database structure or

    schema. Some examples:

    o CREATE - to create objects in the database

    o ALTER - alters the structure of the database

    o DROP - delete objects from the database

    DML

    Data Manipulation Language (DML) statements are used for managing data within

    schema objects. Some examples:

    o SELECT - retrieve data from the a database

    o INSERT - insert data into a table

    o UPDATE - updates existing data within a table

    o DELETE - deletes all records from a table, the space for the records remain

    TCL

    Transaction Control (TCL) statements are used to manage the changes made by DML

    statements. It allows statements to be grouped together into logical transactions.

    o COMMIT - save work done

    o ROLLBACK - restore database to original since the last COMMIT

    A spreadsheet is a computer application that simulates a paper, accounting

    worksheet. It displays multiple cells that together make up a grid consisting of rows and

    columns, each cell containing alphanumeric text, numeric values or formulas. A formula

    defines how the content of that cell is to be calculated from the contents of any other cell

    (or combination of cells) each time any cell is updated. Spreadsheets are frequently used

    for financial information because of their ability to re-calculate the entire sheet

    automatically after a change to a single cell is made.

    A Sample Spreadsheet

    7

    http://en.wikipedia.org/wiki/Computer_applicationhttp://en.wikipedia.org/wiki/Worksheethttp://en.wikipedia.org/wiki/Worksheethttp://en.wikipedia.org/wiki/Alphanumerichttp://en.wikipedia.org/wiki/Formulahttp://en.wikipedia.org/wiki/Financialhttp://en.wikipedia.org/wiki/Computer_applicationhttp://en.wikipedia.org/wiki/Worksheethttp://en.wikipedia.org/wiki/Alphanumerichttp://en.wikipedia.org/wiki/Formulahttp://en.wikipedia.org/wiki/Financial
  • 7/27/2019 DBMSNotes

    8/8

    8