DB Principles Lecture 5&6
DB Principles Lecture 5&6
1. Introduction
2. Definition
Software
The main component of a DBMS is the software. It is the set of programs
used to handle the database and to control and manage the overall
computerized database
1. DBMS software itself, is the most important software component
in the overall system
2. Operating system including network software being used in
network, to share the data of database among multiple users.
3. Application programs developed in programming languages such
as C++, Visual Basic that are used to to access database in database
management system. Each program contains statements that request
the DBMS to perform operation on database. The operations may
include retrieving, updating, deleting data etc . The application
program may be conventional or online workstations or terminals.
Hardware
Data is the most important component of the DBMS. The main purpose of
DBMS is to process the data. In DBMS, databases are defined, constructed
and then data is stored, updated and retrieved to and from the databases.
The database contains both the actual (or operational) data and the
metadata (data about data or description about data).
Procedures
Procedures refer to the instructions and rules that help to design the
database and to use the DBMS. The users that operate and manage the
DBMS require documented procedures on hot use or run the database
management system. These may include.
Procedure to install the new DBMS.
To log on to the DBMS.
To use the DBMS or application program.
To make backup copies of database.
To change the structure of database.
To generate the reports of data retrieved from database.
Users
The users are the people who manage the databases and perform different
operations on the databases in the database system.There are three kinds of
people who play different roles in database system
Application Programmers
Database Administrators
End-Users
Application Programmers
Database Administrators
End-Users
The end-users are the people who interact with database management
system to perform different operations on database such as retrieving,
updating, inserting, deleting data etc.
3.2. Advantages of Database Management Systems
In file system, each application has its own private files, which cannot
be shared between multiple applications.
When the same data is duplicated and changes are made at one site,
which is not propagated to the other site, it gives rise to inconsistency
and the two entries regarding the same data will not agree.
When multiple users share a database, it is likely that some users will
not be authorized to access all information or to do some activities in
the database.
a) Hierarchical databases.
b) Network databases.
c) Relational databases.
d) Object-oriented databases
3.3.3. Relational
Databases:
3.4.3. MySQL
b) A query is a request for data results, for action on data, or for both.
You can use a query to answer a simple question, to perform
calculations, to combine data from different tables, or even to add,
change, or delete table data.
c) A form is a database object that you can use to create a user interface
for a database application. A "bound" form is one that is directly
connected to a data source such as a table or query, and can be used
to enter, edit, or display data from that data source.
d) A report is an object in Microsoft Access that is used to display and
print your data in an organized manner.
Also, you have to consider the type of data that you plan to put in
each field. Some common types are Text, Integer, Currency, and
Date/Time.
Make sure you have installed Microsoft Office package in your computer,
because Microsoft Access is provided with the package. After opening your
program, there are two ways to create your Database file:-
a) Create from a Blank Database choice allows you to create your own
database from scratch.
b) Create from
also offers templates from various
categories, that you can download.
These templates provide the design
and structure of the database, so
you just enter the data.
6.1. Create a blank database
a) On the File tab, click New, and then click Blank Database
b) In the right pane, under Blank Database, type a file name in the File
Name box. To change the location of the file from the default,
click Browse for a location to put your database (next to the File
Name box), browse to the new location, and then click OK
c) Click Create.
Every field in a table has properties. These properties define the field's
characteristics and behavior. The most important property for a field is its
data type. A field's data type determines what kind of data it can store.
For example, a field whose data type is Text can store data that consists
of either text or numerical characters, but a field whose data type is
Number can store only numerical data.
Below table shows the commonly used data types in Microsoft Access
Data Types
Data Type Use Notes
Text Alphanumeric data. Use .
for text and for numbers
that are not used in
mathematical
calculations. Use for
names, addresses, and
other relatively short
pieces of text. Can store
up to 255 characters.
Memo Long text. Use for long
pieces of text, such as
notes and long
descriptions. Can store
up to 64,000 characters.
Number Numeric data. Use for If you are
numbers you want to working with
use in mathematical currency, use
calculations. the currency
type.
Date/Time Use for dates and times.
Currency Use for currency. Prevents
rounding
during
calculation.
AutoNumbe Unique sequential
r numbers or random
numbers automatically
inserted when you
create a record. Use to
create a primary key.
Yes/No Logical data. Use when
only one of two values is
valid. Yes/No,
True/False, etc.
Hyperlink Use to store hyperlinks.
Attachment Use to store
attachments.
OLE Object Use to attach an OLE
object such as a Word
document, Excel
spreadsheet, or
PowerPoint
presentation.
6.2.1. Primary Key
When you create a new database it comes with an empty table named
Table. Using this table you can add new fields, rename the fields and
even change their data types.
c) If you want to change a field name, just double click the name
and type a new name
d) If you want to save the table with a different name, once you
have finish to with the field names, close the form and the
computer will prompt you with an option to save the table
7. Creating Tables
There are two different ways to create tables, using a new blank table button
and blank table from design view.
Data entry form can be created through Form wizard or design view. Once
a table with fields is available it is easy to create a form using wizard.
Note :
This can be a very quick way to build a form, especially if you plan to
put only a few fields on your form.
a) On the Create tab, in the Forms group, click Blank Form.
Access opens a blank form in Layout view, and displays the Field
List pane.
b) In the Field List pane, click the plus sign (+) next to the table or
tables that contain the fields that you want to see on the form.
c) To add a field to the form, double-click it or drag it onto the form.
d) Use the tools in the Header/Footer group on the Design tab to add a
logo, title, or the date and time to the form.
Queries can be used to finds data that’s meet a certain condition that you
specify.
There are two ways to create a query, using query wizard and query
design view.
h) Then click ok
i) Write the name for your query and click finish
In a database, relationships are how your tables "talk" to each other. If your
tables don't talk, you can't get answers from your data. You create
relationships by including a field from one table as a field in a related table.
a) The field you include is called a primary key. Each of the tables in your
database has a primary key, and you include it as a new field in another
table to create a relationship with that other table.
b) When you share a primary key, the new field in the second table is called
a foreign key.
9. Creating Reports
Reports are a way of displaying and printing information from your database.
Developers often use Reports to display the results of a Query, which is what
we are going to do next.
DepartmentID Department
1 Civil Engineering
2 Mechanical Engineering
3 Computer Studies
4 Telecommunication Engineering