W 8 introduction to database


Published on

Published in: Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Data that describe the properties and context of user data.
  • A relational database is a collection of tables from which data can be accessed in many different ways without having to reorganize the database tables.
  • 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
  • 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
  • W 8 introduction to database

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