Date post: | 18-Dec-2014 |
Category: |
Education |
Upload: | bashir-ahmad |
View: | 1,278 times |
Download: | 1 times |
Abdus Salam 1
Week-8Week-8 Introduction to DatabaseIntroduction to Database
Database Management SystemDatabase Management System Relational Database Management SystemRelational Database Management System Database TerminologyDatabase Terminology Types of DatabaseTypes of Database DBMS ApplicationsDBMS Applications Planning Your DatabasePlanning Your Database Database User’sDatabase User’s Database SecurityDatabase Security
Microsoft AccessMicrosoft Access Starting MS AccessStarting MS Access
Opening an Existence Database Opening an Existence Database Creating new DatabaseCreating new Database
Access & Database WindowAccess & Database Window
Abdus Salam 2
Introduction to DatabaseIntroduction to Database
DATABASE is a structure collection of logically related data. or
A database is a collection of records and files that are organized for a particular purpose.
or An organized collection of information in computerized
format.or
A Computerized representation of any organizations flow of information and storage of data.
Abdus Salam 3
Introduction to Database Introduction to Database (Cont’d)(Cont’d)
Data The database is the collection of data about anything, Like cricket
teams, students and many more, anything about which you want to store data.
What we mean by data; simply the facts or figures. Following table shows the things and the data that we may want to store about them:
Cricket Player
Country, name, date of birth, specialty, matches played, runs etc.
Scholars Name, data of birth, age, country, field, books published etc.
Movies Name, director, language (Punjabi is default in case of Pakistan) etc.
Food Name, ingredients, taste, preferred time, origin, etc.
Abdus Salam 4
Introduction to Database Introduction to Database (Cont’d)(Cont’d)
Data is a valuable resource to any business It can be names, addresses, phone numbers, dates etc. Data is a collection of facts made up of text, numbers and dates:
Mr. Khan 35000 7/18/86
Information is the meaning given to data in the way it is interpreted:
Mr. Khan is a sales person whose annual salary is $35,000 and whose hire date is July 18, 1986.
Abdus Salam 5
Introduction to Database Introduction to Database (Cont’d)(Cont’d)
Abdus Salam 6
Database Management SystemDatabase Management System
A DBMS is a software tool that allows multiple users to store, access, and process data into useful information.
Used for Organizing, Storing, Maintaining, Retrieving, and Sorting data.
A RDBMS is a collection of tables that are related to one another based on a common field.
A relational database uses multiple tables
Example: Microsoft Access, dBASE, FOXPRO, Oracle. To manage databases, companies purchase programs called
RDBMS Student Information System Inventory System
Abdus Salam 7
Database TerminologyDatabase Terminology
Database File The main file that include the entire database and that is saved to
your hard-drive or floppy disk. For example StudentDatabase.mdb Entity
Real world things (entities) you need to store information about. For example Employees, Products, Customers, Orders. Entities are represented by tables in the database
Table A table is a collection of data about a specific topic, such as
students or contacts, Customers, Orders, or products. Information about a single subject such as customers, orders,
employees, products, or companies is also called Relation.
Abdus Salam 8
Database TerminologyDatabase Terminology Field
Facts (attributes) you need to know about each entity, e.g. an Employee’s date of birth, salary.
Attributes are represented by fields in the tables A field is a single characteristic of a person, place, object,
event or idea. Record
A set of related field values. Degree
Degree is the number of attributes in a relation. Cardinality
Cardinality is the number of tuples in a relation.
Abdus Salam 9
ExampleExample
Records
Fields
Student ID Student Name Phone Department
101 Khan 392-3900 Pharmacy
102 Jawad 392-5555 Statistics
103 Imran 846-5656 Economics
Course Code
Course Name
Student ID
1001 Botany 101
1002 SPSS 102
Abdus Salam 10
Primary Key & Foreign KeyPrimary Key & Foreign Key Primary Key To ensure that each record is unique in each table, we can set
one field to be a Primary Key field. A Primary Key is a field that will contain no duplicates and no
blank values. Or A Primary key is a field, or a collection of fields, whose values
uniquely identify each record
Foreign Key When the primary key is included in a second table, it’s called as
a Foreign key Foreign Keys link to data in other tables
Abdus Salam 11
Fields, Records and a TableFields, Records and a Table
Abdus Salam 12
Relating Tables Using a Common Relating Tables Using a Common FieldField
Abdus Salam 13
Relating Tables Using a Common FieldRelating Tables Using a Common Field
(Cont’d)(Cont’d)
Abdus Salam 14
What is a Relational Database What is a Relational Database Management System (RDMS)?Management System (RDMS)?
Relationships between the entities in the database; i.e. what attributes do they have in common.
Relationships are formed in the database between entities that have common attributes. They have common fields in the related tables.
For example, customer ‘Hassan’ can place an order for product ‘Laptop’.
So the Orders table has relationships with Customers table & Products table
DON’T DUPLICATE DATA
That is, once relationships are created, tables can “talk” to each other. We can link (relate) the tables to find:
Abdus Salam 15
Types of DatabaseTypes of Database Centralized Database Distributed Database
Centralized Database A logically interrelated collection of shared data, physically
located on a central computer and the user access this data base through their terminals.
All the processing is performed on that central computer. Distributed Database
A logically interrelated collection of shared data, physically distributed over a computer network.
A distributed database (DDB) is a collection of multiple, logically interrelated databases distributed over a computer network.
Abdus Salam 16
Types of Database Types of Database (Cont’d)(Cont’d)
Abdus Salam 17
DBMS ApplicationsDBMS Applications
DBMS touch all aspects of our lives Banking: all transactions Airlines: reservations, schedules
Universities: registration, grades
Sales: customers, products, purchases
Online retailers: order tracking, customized recommendations Manufacturing: production, inventory, orders, supply chain
Human resources: employee records, salaries, tax deductions
Abdus Salam 18
Database ApplicationsDatabase Applications (Cont’d)(Cont’d)
The purpose of a relational database management system is to to transformtransform
DataData InformationInformation KnowledgeKnowledge ActionAction
Data driven decision makingData driven decision making
Abdus Salam 19
Planning Your DatabasePlanning Your Database
Creating and working with databases in Microsoft Access requires thorough planning.
If you plan your database in advance, it will save you a lot of time and effort later.
Follow these guidelines before you start creating your database: Determine the purpose of your database
(this will help you decide what information to include, and how to organize your fields)
Include only related information (this will make your database more meaningful and easier
to work with) Review existing files that can provide information necessary
for your database (e.g. paper files, electronic files, etc.)
Abdus Salam 20
Planning Your Database Planning Your Database (Cont’d)(Cont’d)
Plan fields in your table ahead of time (list all the fields you need to include in your table before
starting in Access) Break up fields into smallest meaningful values
(e.g. Name into LastName, FirstName) Enter data
(type your information) Finalize design
(convert your database into a Form or a Report)
Abdus Salam 21
Database UserDatabase User Users of Database Systems:
Application Programmers End Users
Naïve User Sophisticated User Database Administrator
Application programmers: who create different types of database application programs Application programmers design the application according to the needs Application programmers are skilled people who have clear idea of the
structure of the database and know clearly about the needs of the organizations.
End Users: Group of users contains the people who use the database application
programs developed by the Application programmers. This category further contains three types of users
Abdus Salam 22
Database User Database User (Cont’d)(Cont’d)
This category further contains three types of users Naïve Users Sophisticated Users Database Administrator Naïve Users
Simply use the application database programs created by the programmers.
Has no interaction with other parts of there database and only use the programs meant for them.
They have not to worry about the further working of the database. Sophisticated Users:
Have some additional rights over the Naïve users, which means that they can access the data stored in the database any of their desired way.
Can access data using the application programs as well as other ways of accessing data.
Abdus Salam 23
Database User Database User (Cont’d)(Cont’d)
Database Administrators (DBA): The most technical class of db users. Have the knowledge of how to design and manage the database use
as well as to manage the data in the database. DBA is a very responsible position in an organization. Responsible for proper working of the database and RDBMS, has the
responsibility of making proper database backups and make necessary actions for recovering the database in case of a database crash.
To fulfill the requirements of a DBA position a DBA needs vast experience and very elegant technical skills.
Abdus Salam 24
Database User Database User (Cont’d)(Cont’d)
Database Administrator takes over the charge and performs specific DBA related activities including:
Database maintenance Database Backup Grant of rights to database users
Responsible for grant of access rights to the database users. Granting and revoking (taking back) the rights
Monitoring of Running Jobs When a new database is created it takes a limited space but as a result of daily
activity the database acquires more data and grows in size very rapidly. The DBA has to monitor the disk space usage and statistics to ensure that no
data over flow occurs at any stage. Managing Print jobs
Abdus Salam 25
Database SecurityDatabase Security
Protection from malicious attempts to steal or modify data. Database security means to protect the data from
unauthorized (access) users, which can modify, update, destroy or delete the data is known as Database security.
Thus data base is always under a responsible person called DBA.
Authentication and authorization mechanisms to allow specific users access only to required data.
Abdus Salam 26
The Integrity of a DB is concerned with its consistency, correctness, validity and accuracy.
Database integrity refers to the validity and consistency of stored data.
Integrity is usually expressed in terms of constraints, which are consistency rules that database is not permitted to violate.
Enforcing integrity constraints generally requires access to a large amount of data that defines the constraints but which is not involved in the actual update operation itself.
In a distributed DBMS, the communication and processing costs that are required to enforce integrity constraints may be prohibitive.
IntegrityIntegrity
Abdus Salam 27
Types of Integrity Types of Integrity
Relational IntegrityRelational Integrity CREATE Table Student The primary key can neither be null nor duplicate.
(Std-ID INTEGER NOT NULL)
Referential IntegrityReferential Integrity Thus referential integrity means that, if the foreign key contains a
value, that value must refer to an existing, valid row in the parent table.
Abdus Salam 28
Think about the data that you may want to store about different things around you
List the changes that may arise during the working of any system,
lets say Railway Reservation System
Abdus Salam 29
Microsoft AccessMicrosoft Access Microsoft Access is a powerful program to create and manage
your databases. Microsoft Access can be used for Personal Information
Management (PIM), in a small business to organize and manage data, or in an enterprise to communicate with servers.
Protects database entries Manipulate massive amounts of data Each database can be up to 2GB size! Each database can contain up to 32,768 objects!
Abdus Salam 30
Starting MS Access 2003 Starting MS Access 2003 In the Open area of the Access 2003
Getting Started Task Pane, click the left mouse button on Create a new file.
Abdus Salam 31
Open an Existing DatabaseOpen an Existing Database To open an existing database, you must first start Access. When Access is launched you will see the Access window, with
the task pane on the right side of the window.
From the task pane you can open an existing database by: Selecting the database you want from the list of Recently opened
databases
Abdus Salam 32
Creating New DatabaseCreating New Database The New File menu screen at on the right will
appear when you click the left mouse button on Create a new file.
Click–on Blank database.
Abdus Salam 33
Creating New Database Creating New Database (Cont’d)(Cont’d)
A File New Database menu screen, similar to the one below, will be on your screen. We’ll have to do several “things” to set-up this screen to save your database. click-on the Create button
The main file that include the entire database and that is saved to your hard-drive or floppy disk. For example StudentDatabase.mdb.
Abdus Salam 34
The Database windowThe Database window The Database window is the main control center for working with
an MS Access database. The Database window contains a menu bar, an objects bar, and a
groups bar. The Objects bar lists all the objects available in the database The list of objects consists of tables, queries, forms, reports,
pages, macros, and modules You can click on any of the objects in the Objects bar to
obtain a list of objects of that type
Abdus Salam 35
The Database window The Database window (Cont’d)(Cont’d)
Abdus Salam 36
The Database window The Database window (Cont’d)(Cont’d)
The Database window is the command center of your database; here you can create and use any object, such as Tables, Queries, Forms, Reports, Pages, Macros, and Modules
Database objects are the basic components that make up a database. Tables – used to enter, store, organize data.
For example, one table could store a list of students and their IDs, while another table could store their Subject Information.
Queries – used to extract data from a database. Queries ask a question of data stored in a table.
For example, a query could display, the students having CGPA 3.5 in BBA 5th Semester
Abdus Salam 37
The Database window The Database window (Cont’d)(Cont’d)
Forms – used to enter, edit, or view data stored in a table or a query.
Reports – used to display and print selected information from a table in a visually appealing customized way. Or Reports are preformatted query results
Pages - Create data access pages that allow users to view and browse the data (in your Access database) from Microsoft Internet Explorer.
Macro design a macro that opens a second form in response to the selection of an item on a main form. Or
Can use macros to open and execute queries, to open tables, or to print or view reports.
Module An object containing custom procedures, that code using Visual Basic.
Abdus Salam 38
?IF ANY