Database Management System Document Notes (1)

Embed Size (px)

Citation preview

  • 7/24/2019 Database Management System Document Notes (1)

    1/14

    DATABASES MANAGEMENT SYSTEMS (DBMS) DOCUMENT NOTES

    Author: Mary Waswa-Wilson

    Dat: !th"un #$%&

    Data'as Manant Systs (DBMS)

    O'*+ti,s

    1) To define Database Management Systems (DBMS)

    2) To understand and define various terms and basic functionalities of

    phpmyadmin interface

    3) earn to install! configure a MyS" database

    #) To create users on MyS"

    $) To be able to list databases and creating tables

    %) To populate and &uery databases

    By th n o. th oul/ 0arti+i0ants shoul ' a'l to:-

    1' Design a simple database ith 3rdlevel normaliation2' *nstall a MyS" server using +ampp3' ogin to MyS" Server and implement the database designed above

    #' ,opulate and &uery the database using different means- ,hpmyadmin!command line

  • 7/24/2019 Database Management System Document Notes (1)

    2/14

    DATABASE MANAGEMENT SYSTEMS (DBMS)What is a Data'as1

    . database is an integrated collection of logically related records or files

    consolidated into a common pool that provides data for one or more multiple

    uses' /ou can thin0 of a database as an electronic filing system'

    A Data'as Manant Syst (DBMS)

    Softare that organies the storage of data' . DBMS controls the creation!

    maintenance! and use of the database storage structures of organiations and of

    their end users' *n large organiations this tas0 is being manned by a Database

    .dministrator

    Database management systems are usually categoried according to the

    database model that they support! such as the netor0! relational or obectmodel' The model tends to determine the &uery languages that are available to

    access the database' ne commonly used &uery language for the relational

    database is S"!

    Database management systems range from all systemsthatrunon personal

    computersto huge systems that run on mainframes' .fter storage a DBMS

    needs an application that can enable us access! modify the information in a

    contetual manner' 4amples of database applicationsmay include-

    o 5omputeried library systems 6 7oha

    o .utomated teller machines (.TM)

    o 8light reservation systems

    o 5omputeried parts inventory systems

    Data'as Manant Syst (DBMS)

    There are several Database Management Systems (DBMS)! such as-

    Microsoft S" Server

    racle

    Sybase

    DBase

    Microsoft .ccess

    MyS" from Sun Microsystems (racle)

    DB2 from *BM etc'

    http://www.webopedia.com/TERM/S/system.htmlhttp://www.webopedia.com/TERM/R/run.htmlhttp://www.webopedia.com/TERM/R/run.htmlhttp://www.webopedia.com/TERM/P/personal_computer.htmlhttp://www.webopedia.com/TERM/P/personal_computer.htmlhttp://www.webopedia.com/TERM/M/mainframe.htmlhttp://www.webopedia.com/TERM/D/database_management_system_DBMS.htmlhttp://www.webopedia.com/TERM/R/run.htmlhttp://www.webopedia.com/TERM/P/personal_computer.htmlhttp://www.webopedia.com/TERM/P/personal_computer.htmlhttp://www.webopedia.com/TERM/M/mainframe.htmlhttp://www.webopedia.com/TERM/D/database_management_system_DBMS.htmlhttp://www.webopedia.com/TERM/S/system.html
  • 7/24/2019 Database Management System Document Notes (1)

    3/14

    The goal of a DBMS is to provide an environment that is both +on,nintand..i+intto use in

    9etrieving information from the database'

    Storing information into the database'

    Databases are usually designed to manage larbodies of information' Thisinvolves Definition of structures for information storage (data modeling)'

    ,rovision of mechanisms for the manipulation of information (file andsystems structure! &uery processing)'

    ,roviding for the safety of information in the database (crash recovery and

    security)' 5oncurrency control if the system is shared by users'

    *n our study! this document ill focus on MyS" server as our case study

  • 7/24/2019 Database Management System Document Notes (1)

    4/14

    DBMS Trinolois:

    5ase Study of MyS"- Before e proceed to eplain MyS" database system!

    let:s revise fe definitions related to database'

    Data'as:. database is a collection of tables! ith related data'

    Ta'l:. table is a matri ith data' . table in a database loo0s li0e a

    simple spreadsheet'

    Colun:ne column (data element) contains data of one and the same

    0ind! for eample the column postcode'

    2ow:. ro (; tuple! entry or record) is a group of related data! for

    eample the data of one subscription'

    2unan+y:Storing data tice! redundantly to ma0e the system faster'

    3riary 4y:. primary 0ey is uni&ue' . 0ey value cannot occur tice in

    one table'

  • 7/24/2019 Database Management System Document Notes (1)

    5/14

    MyS89

    MyS" is a fast! easy6to6use 9DBMS being used for many small and big

    businesses' MyS" is becoming so popular because of many good reasons-

    MyS" is released under an open6source license' So you have nothing to

    pay to use it'

    MyS" is a very poerful program in its on right' *t handles a large

    subset of the functionality of the most epensive and poerful database

    pac0ages'

    MyS" uses a standard form of the ell60non S" data language'

    MyS" or0s very &uic0ly and or0s ell even ith large data sets'

    MyS" is very friendly to ,=,! the most appreciated language for eb

    development'

    Exercise One: on Practice

  • 7/24/2019 Database Management System Document Notes (1)

    6/14

    What as u0 a ata'as1

    Ta'ls

    The basic units in a database are tables and the relationship beteen them'

    Strictly! a relational database is a collection of relations (fre&uently called tables)'

    Uni;u y

    *n relational database design! a uni&ue 0ey or primary 0ey is a candidate 0ey to

    uni&uely identify each ro in a table' . uni&ue 0ey or primary 0ey comprises a

    single column or set of columns' >o to distinct ros in a table can have the

    same value (or combination of values) in those columns'

    A 0riary y

    *s a special case of uni&ue 0eys' The maor difference is that for uni&ue 0eys the

    implicit >T >? constraint is not automatically enforced! hile for primary

    0eys it is enforced' Thus! the values in uni&ue 0ey columns may or may not be

    >?'

    5orin y

    *n the contet of relational databases! a foreign 0ey is a referential constraint

    beteen to tables' The foreign 0ey identifies a column or a set of columns inone table that refers to a column or set of columns in another table' The columns

    in the referencing table must be the primary 0ey or other candidate 0ey in the

    referenced table' The values in one ro of the referencing columns must occur in

    a single ro in the referenced table' Thus! a ro in the referencing table cannot

    contain values that don:t eist in the referenced table'

  • 7/24/2019 Database Management System Document Notes (1)

    7/14

    5un+tions

    *n S" databases! a user6defined function provides a mechanism for etending

    the functionality of the database server by adding a function that canbe evaluated

    in S" statements'

    Trirs

    . database trigger is procedural code that is automatically eecuted in response

    to certain events on a particular table or vie in a database' The trigger is mostly

    used for 0eeping the integrity of the information on the database' 8or eample!

    hen a ne record (representing a ne or0er) added to the employees table!

    ne records should be created also in the tables of the taes! vacations! and

    salaries'

  • 7/24/2019 Database Management System Document Notes (1)

    8/14

    T=E 3=3MYADM6N COMMAND

  • 7/24/2019 Database Management System Document Notes (1)

    9/14

    Unrstanin Ta's in th 6ntr.a+

    Stru+tur: ists the structor of the databases

    S89: 9un S" &uery@&ueries on database mys&l-

    Sar+h: Search in database

    8ury: ?sed to rite &ueries and vues from table

    E70ort: Aie dump (schema) of database! 4port

    60ort: introduce@ import a file

    O0rations: Basic perations ithin the database

    3ri,ils:.ccessing database and user scope to manipulate the database

    Dro0: ?sed to delete a database or table

    Data'as ta'ls

    9istin an +ratin ata'as ta'ls

    .t its simplest! a database ill consist of tables li0e this-

    Na A 5a,orit Color

    7en one of your business'

    The above is the basic premise of a simple database table! even a real one

    having millions of records'

    3O3U9AT6NG AND 8UE2Y6NG DATABASES

    .fter creating your database! inserting tables! you need to populate it' The 9OAD

    DATAand 6NSE2Tstatements are useful for this'

    http://localhost/phpmyadmin/db_structure.php?db=mysql&token=99eaf049cfcb3c3b4f0c45b24816776ehttp://dev.mysql.com/doc/refman/5.1/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.1/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.1/en/insert.htmlhttp://localhost/phpmyadmin/db_structure.php?db=mysql&token=99eaf049cfcb3c3b4f0c45b24816776ehttp://dev.mysql.com/doc/refman/5.1/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.1/en/load-data.htmlhttp://dev.mysql.com/doc/refman/5.1/en/insert.html
  • 7/24/2019 Database Management System Document Notes (1)

    10/14

    Suppose that your table as to hold your pet information' Then the records can

    be described as shon here'

    na ownr s0+is s7 'irth ath

    8luffy =arold cat f 136E26E#

    5las Fen cat m 1#6E361

    Buffy =arold dog f 1C6E$613

    8ang Benny dog m 1E6EC62

    Boser Diane dog m 16EC631 1$6E62

    5hirpy Fen bird f 1C6E611

  • 7/24/2019 Database Management System Document Notes (1)

    11/14

    %&ERE con'itions_to_satis" #$at_to_select

    *ndicates hat you ant to see' This can be a list of columns! or >to indicate Gall

    columns'H #$ic$_tableindicates the table from hich you ant to retrieve data'

    The W=E2Eclause is optional' *f it is present! con'itions_to_satisspecifies

    one or more conditions that ros must satisfy to &ualify for retrieval'

    Ba+- U0s

    6ntrou+tion

    *t is very important to do bac0up of your MyS&l database! you ill probably

    realie it hen it is too late'

    . lot of eb applications use MyS&l for storing the content' This can be blogs!

    and a lot of other things'

  • 7/24/2019 Database Management System Document Notes (1)

    12/14

    2' Ma0e sure that you have selected to eport your entire database! and not ust

    one table' There should be as many tables in the eport list as shoing under the

    database name'

    3' SelectIS"I6J for output format! 5hec0 IStructureI and I.dd

    .?TK*>594M4>TI value' 5hec0 I4nclose table and field name ith

    bac0&uotesI' 5hec0 ID.T.I! chec0 use Iheadecimal for binary fieldI' 4port

    type set to I*>S49TI'

    #' 5hec0 ISave as fileI! do not change the file name! use compression if you

    ant' Then clic0 IFI to donload the bac0up file'

  • 7/24/2019 Database Management System Document Notes (1)

    13/14

    2storin a 'a+u0 o. a MyS;l ata'as

    1' To restore a database! you clic0 the S" tab'

    2' n the IS"I6page ! unclic0 the sho &uery here again'

    3' Brose to your bac0up of the database'

    #' 5lic0 Fo'

  • 7/24/2019 Database Management System Document Notes (1)

    14/14