for Hospitality and Tourism by Lerluck Boonlamp 7/08 2 Overview 1. Database 2. Relational Database Basics 3. Using Excel as a Database 4. Using Microsoft Access 3 Why Database? we have many of Data in organization we record many of Data processes we record many of Data transaction we need Information to support a decision we need a Report at the end of day, week, month and year 4 1. What is Database? A database is a collection of data that is organized so that its contents can easily be accessed, managed, and updated. It is designed to meet the information needs and shared among users in an organization 5 Examples of database: Guest History List (name, addresses, how long they stayed, room, etc) Supplier Information (name, addresses, what they sell, etc.) Travel Agent Data (name, addresses, #guests they have sent, etc) Sales Database(product name, supplier detail, customer detail, shipping detail) Corporate Database(data about management, marketing, materials, manufacturing and accounting) 6 Why database is important? Today organization consider data and informationas one of the most important resources. Support Decision Making 7 Data & Information Data is raw facts about anything. Data is what stored in database. Ex. About people, events Information is the data that has been processed or transformed so that it is more meaningful for analysis and decision making Information consists of a set of data which is an answer to a particular question. Ex. what products sold well in the past week, month or year? 8 Changing data to information Data Information Processing * Your phone number * The number that you call * Time you start * Time you finish Telephone Bill 9 How is data stored in a database? In a database, data is mostly stored in the form of table. 10 Data Management There are 2 ways to manage data: 1. File systems 2. Database systems HOW 11 1) File Systems 12 Disadvantages of File Systems Uncontrolled Redundancy Inconsistent Data Limited Data Sharing Poor Enforcement of Standard File Systems 13 2) Database Systems 14 Database Management System (DBMS) DBMS is a kind of software that is used to manage a database. Ex. Microsoft Access, MS Foxpro, Lotus Smart Suite, Oracal Server, IBM DB2, Microsoft SQL Server and MySql Server. Database Systems 15 Database Management System (DBMS) Database Systems 16 How is a database used? 1. Personal Computer Database 2. Central Computer Database 3. Client/Server Database or Two- Tiered Database 4. Distributed Database 17 1) Personal Computer Database 18 2) Central Computer Database Terminal is a computer that has no processing unit. It acts as an interface only. 19 3) Client/Server DB or Two- Tiered DB 20 4) Distributed Database 21 Database Personnel (User) 1. Database Administrator 2. Database Programmer 3. End User 22 1) Database Administrator (DBA) Database Administrator (DBA) The information specialist who is expert in developing, providing, and securing database Oversee all database activities Managerial skills, high technical skills Must understand the business operations of the firm 23 2) Database Programmer Represent a high level of specialization and selection Write code to strip and/or aggregate data from the database 24 3) End User As important personnel who interact with the database Generate report and form Post queries to the database Use results from their database inquiries to make decision 25 DBMS Advantage Reduce data redundancy Achieve data independence Retrieve data and information rapidly Improve security 26 DMBS Disadvantage Obtain expensive software Obtain a large hardware configuration Hire and maintain a DBA staff 27 2. Relational Database Basic Table Relationship Primary key Foreign key And data integrity 28 2.1 Table In relational database, a relation is looks like a table. Thus, relation and table are the term used interchangeably. Row is also record. Column is also called field. 29 2.2 Primary In relational database, each record in a table must be unique. That means there must be a field that contains a value that is different from other records. That filed that make records unique is called a primary key. 30 Which field should be defined as the primary key? 31 Primary key Adding an extra field that contains unique value in each record to represent a primary key is a technique that often used to simplify table design when there is no appropriate field (or fields) to use as primary key. 32 2.3 Relationship Data is stored in separated table. Then you define relationships between tables. Relationship can be in 3 forms One-to-one One-to-many Many-to-many 33 One-to-one relationship (1:1) One-to-one relationship means that one record in the first table has a relationship with only one record in the 2 nd table, and vice versa 34 One-to-Many Relationship (1:M) Means that one record in the first table has a relationship with many records in the 2 nd table, and vice versa. 35 Many to Many relationship (M:M) Means that many records in the first table has a relationship with many records in the 2 nd table, and vice versa. 36 2.4 Foreign Key A database generally contains more than one table that are related. A relationship is established through a foreign key. A foreign key is a field that is its value is taken from the value in primary key field in another table. 37 Foreign key BAD table 38 Foreign Key Primary key Primary key T a b l e
1 T a b l e
2 39 Foreign Key Primary key Foreign key Primary key 40 2.5 Integrity Rules Must follows two rules: Entity integrity The primary key must be unique and must not be null. Referential Integrity The foreign key must be in referenced table Or be null 41 Entity Integrity 42 Entity Integrity 43 3. Using Excel as Database As data mostly stored in the form of tables. Excel is often used to store data and do simple queriesto get information that is needed. 44 4. Access Data Type Type of Number 45 Data Type 46 Type of Number