Академический Документы
Профессиональный Документы
Культура Документы
DBMS
A database management system (DBMS) is a set of computer-based application programs that support the processes of storing, manipulating, retrieving and presenting the data within the database. Acts as an interface between application programs & physical data files The data within the database are organized into tables, records, and fields.
Table
A table is the primary unit of physical storage for data in a database.1 Usually a database contains more than one table.
Table
Authors
Inventory
Orders
Table
Customers
Field (Column)
Customers
a field
Record (Row)
Customers
a record
Primary Key
Customers
primary key field Primary key is a unique identifier of records in a table. Primary key values may be generated manually or automatically.
Primary Key
Roles (Performances)
primary key fields A primary key can consist of more than one field.
Foreign Key
Directors
parent table
relationship
child table
Movies
Relationship Types
One-to-one One-to-many Many-to-many
Data Types
Alphanumeric (Text, Memo) Numeric (Number, Currency, etc.) Date/Time Boolean (Yes/No)
Database Environments
Mainframe Client/Server Internet-based
Definitions
Relational database: A collection of tables. Table: A collection of columns (attributes) describing an entity. Individual objects are stored as rows of data in the table. Property (attribute): a characteristic or descriptor of a class or entity. Every table has a primary key. The smallest set of columns that uniquely identifies any row Primary keys can span more than one column (concatenated keys) We often create a primary key to insure uniqueness (e.g., CustomerID, Product#, . . .) called a surrogate key.
Properties Employee
FirstName Abdul Roland John Susan
Class: Employee
Address 252 South Street 937 Paramaribo Lane 234 Main Street 8934 W. Maple
Advantages of DB
Controlling Redundancy Restricting Unauthorized Access Providing persistent storage for program objects Proving storage structures for efficient query processing Providing backup and recovery Providing multi-user interfaces Representing complex relationships among data Enforcing integrity constraints Permitting inferencing and actions using rules Additional implications of using the DB approach
Classification of DBMS
Based on Data Model
Relational, object, object-relational, hierarchical, network
Number of sites
Centralized, Distributed, Homogeneous
Contents of a Database
A Database contains:
User Data Metadata Indexes Applications
User Data
End-users work directly with the DBMS by entering, updating and viewing the data. Typically they would use a query language (SQL) In a relational DB, data will be generally stored in tables with some relationships between tables. Each table has one or more columns (attributes). For example, below is a bank account table.
ustomer I
cct
umber
ate pene / / / / / / / / / / / / / /
alance . . . . . . .
Metadata
Data about data. Data that describes how users data are stored in terms of table name, column name, data type, length, primary keys, etc. Metadata are typically stored in System tables and are typically only directly accessible by the DBMS or by the system administrator. For example, the metadata for the bank account table, could be:
Indexes
Allow users to access a specific record without having to search through the entire table
For example, indexes would be used to find all customers who opened the account before 01/01/2000. In this case the bank account table is indexed on date opened attribute (see below)
Indexes provide efficient data access on one hand, but are expensive to maintain: Updating data requires an extra step: Index(s) must also be updated.
ustomer I 100 100 1001 1001 1002 100 100 Acct 2 0 11 22 2 umber Acct pe hecking avings hecking avings avings hecking avings ate Opened 11/1 /1 /22/1 10/12/1 10/12/1 1/ /1 10/1/2000 12/11/2000 alance 00.00 00.00 000.00 2000.00 10000.00 000.00 000.00
Applications are various programs written in various languages to access and manipulate the data. Each application is designed for a specific aspect of a given functional area, e.g., payroll application, accounting, etc.
Data Model:
A set of primitives for defining the structure of a database. A set of operations for specifying retrieval, and updates on a database.
Design - example
Design tables for the following scenario: Stock management of a company 500 items Three types (A/B/C) Items receipt and issues on a daily basis Generate reports