






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Author: Mary Waswa-Wilson Date: 5 th^ June 2013
Database Management Systems (DBMS)
Objectives
By the end of the module, participants should be able to:-
What is a Database? A 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. You can think of a database as an electronic filing system. A Database Management System (DBMS) Software that organizes the storage of data. A DBMS controls the creation, maintenance, and use of the database storage structures of organizations and of their end users. In large organizations this task is being manned by a Database Administrator Database management systems are usually categorized according to the database model that they support, such as the network, relational or object model. The model tends to determine the query languages that are available to access the database. One commonly used query language for the relational database is SQL, Database management systems range from all systems that run on personal computers to huge systems that run on mainframes. After storage a DBMS needs an application that can enable us access, modify the information in a contextual manner. Examples of database applications may include:
DBMS Terminologies:
Case Study of MySQL: Before we proceed to explain MySQL database system, let's revise few definitions related to database.
MySQL
MySQL is a fast, easy-to-use RDBMS being used for many small and big businesses. MySQL is becoming so popular because of many good reasons:
Exercise One: on Practice
Functions In SQL databases, a user-defined function provides a mechanism for extending the functionality of the database server by adding a function that canbe evaluated in SQL statements.
Triggers A database trigger is procedural code that is automatically executed in response to certain events on a particular table or view in a database. The trigger is mostly used for keeping the integrity of the information on the database. For example, when a new record (representing a new worker) added to the employees table, new records should be created also in the tables of the taxes, vacations, and salaries.
Working with databases can be a complex and confusing process. Fortunately PhpMyAdmin provides an easy to use and easy to understand interface to administer your database(s). It was intended to handle the administration of MySQL via a web browser. PhpMyAdmin supports a wide range of operations with MySQL. The most frequently used operations are supported by the user interface (managing databases, tables, fields, relations, indexes, users, permissions, etc), while you still have the ability to directly execute SQL statements.
Figure : phMyadmin interface
Understanding Tabs in the Interface Structure: Lists the structor of the databases SQL: Run SQL query/queries on database mysql: Search: Search in database Query: Used to write queries and vuews from table Export: View dump (schema) of database, Export Import: introduce/ import a file Operations: Basic Operations within the database Privileges: Accessing database and user scope to manipulate the database Drop: Used to delete a database or table Database tables Listing and creating database tables
INSERT Statement The INSERT INTO SELECT statement selects data from one table and inserts it into an existing table. Any existing rows in the target table are unaffected. INSERT INTO table (column_name(s)) SELECT column_name(s) FROM table1;
SELECT Statement The SELECT statement is used to pull information from a table. The general form of the statement is: SELECT what_to_select FROM which_table WHERE conditions_to_satisfy; what_to_select Indicates what you want to see. This can be a list of columns, or *****^ to indicate “all columns.” which_table indicates the table from which you want to retrieve data. The WHERE^ clause is optional. If it is present,^ conditions_to_satisfy^ specifies one or more conditions that rows must satisfy to qualify for retrieval.
Introduction It is very important to do backup of your MySql database, you will probably realize it when it is too late. A lot of web applications use MySql for storing the content. This can be blogs,
and a lot of other things. When you have all your content as html files on your web server it is very easy to keep them safe from crashes, you just have a copy of them on your own PC and then upload them again after the web server is restored after the crash. All the content in the MySql database must also be backed up. A lot of web service providers say they do backup of all the files, but you should never blindly trust them. If you have spent a lot of time making the content and it is only stored in the Mysql server, you will feel very bad if it gets lost for ever. Backing it up once every month or so makes sure you never loose too much of your work in case of a server crash, and it will make you sleep better at night. It is easy and fast, so there is no reason for not doing it.
Backup of Mysql database Open phpMyAdmin.
Restoring a backup of a MySql database