DATABASES Pindaro Demertzoglou – Lally School of Management and Technology.
-
Upload
deborah-haynes -
Category
Documents
-
view
222 -
download
4
Transcript of DATABASES Pindaro Demertzoglou – Lally School of Management and Technology.
Microcomputers and applications
THE OPERATIONAL, TACTICAL, AND STRATEGIC AREAS OF AN ORGANIZATION
Strategic
Tactical
Transactional/Ops
Microcomputers and applications
Application Layer
TPS ARCHITECTURE
Data Layer
Sales/Marketing HRFinance/Accounting Operations
Spreadsheet Data
MS Access
AccountsReceivable
AccountsPayable
InvestmentManagement
Oracle Database
QuotationProcessing
OrderProcessing
ClaimsProcessing
Spreadsheet
Oracle Database
Foxpro
RecruitingCareer Planning
CompensationManagement
Excel
Excel
Excel
ProductionPlanning
Product Development
Maintenance Planning
Oracle
Excel
Oracle
Microcomputers and applications
OPERATIONS AND ORGANIZATIONAL EFFICIENCY
Management in lean times and cost reduction. Corporate operations and Operating Expenses
in the Income Statement The goal is to reduce inefficiency. We reduce inefficiency by reducing operating
expenses. We reduce operating expenses by creating a
leaner TPS system. A leaner TPS system means reduced cycle
times and reduced cost. As a consequence we have reduced risk from
variations in the market.
Microcomputers and applications
TYPES OF DATABASES
According to License Type Commercial (Oracle, Microsoft SQL server, IBM DB2) Open Source (PostgreSQL)
According to Network Architecture Desktop (MS Access) Client-Server (Oracle, IBM DB2, MS SQL)
Microcomputers and applications
DATABASE TABLES
Tables (entities) Fields (Attributes) Data types (text, number, Currency, Binary) Records (A group of related fields)
Keys Primary Foreign One-field keys Concatenated keys Natural keys Surrogate keys (Artificial)
Microcomputers and applications
RELATIONSHIPS One to one
relationships
One to many relationships
Many to many relationships
Microcomputers and applications
REFERENTIAL INTEGRITY Referential integrity in relational databases means
that relationships among joined tables remain consistent.
That is, if we have a one-to-many relationship between customers and orders: We cannot delete a customer for whom we have orders. We cannot add an order without having a customer. We can have however customers without orders.
Orphaned Records. With referential integrity on, we avoid orphaned records. For example, an order without a customer.
However, we can have customers without orders which is a business fact.
Microcomputers and applications
INDEXES
• Indexes improve data retrieval.
• They work great with WHERE and ORDER BY clauses.
• Indexes slow down data inserts and updates since updates and inserts need to be saved at both the table and the index.
• Increase storage requirements.
• Unique indexes can be used as constraints.
• Avoid their usage in small tables with few records. Better used in large tables.
• All primary key fields are automatically indexed when created.
• We can also have multiple-field indexes.
Microcomputers and applications
NORMALIZATION
A two-aim process: Redundancy (Elimination of duplicated data) Inconsistent Dependency (Data should be related to
entities ie. Orders must be in a separate table rather than in the customer table)
First Normal Form (Do not use multiple fields in a table to store similar data. Ie. five fields in an inventory table to identify vendors. What happens if we add a new vendor?)
Second Normal Form (Do not store the same data in multiple tables. Ie An address is needed in the customer’s table, shipping, billing etc.) create a separate table for addresses.
Third Normal Form (Exclude from the table fields that do not depend on the key ie For example instead of storing the zip code in the address table that you created above you create a separate table for zip codes.) Not always practical.
Remember: business rules have priority.
Microcomputers and applications
CASCADE UPDATES AND DELETES
Cascade deletes allow us to delete an entity record and all associated information to that entity record.
For example, if cascade deletes are on between the tables customers and orders, then when we delete a customer, all related orders will be deleted by the database engine.
Cascade updates let us update all primary keys of an entity and their related foreign keys in all related tables.
For example, if cascade updates are on between the tables customers and orders, then when we update the PK value of a customer, all related foreign keys of that customer in the table orders will be updated by the database engine.
Microcomputers and applications
QUERIES SQL statements through which we can select,
delete, insert, and update data. With queries we obtain a subset of attributes, or a
subset of records, or a subset of attributes and records.
They can function as a security mechanism so that end users do not have direct access to tables.
Views can present data from multiple different related tables in a simplified datasheet.
Queries can aggregate data for information generation.
Views do not consume any space, we just store the SQL statement which we can execute at any moment.
Microcomputers and applications
SQL Language Data Definition Language Data Manipulation Language
CREATE TABLE Customer1 (
[CustomerID] Counter PRIMARY KEY NOT NULL,
[LastName] text(50) NOT NULL,
[FirstName] text(50),
[Address] text(50));
Microcomputers and applications
SQL LANGUAGE (DATA MANIPULATION LANGUAGE)
Select statements Example: Select * from products
Insert statements
Example: Insert into products (productname, unitprice) values ('myproduct', 22)
Update statements
Example: update products set unitprice = unitprice*1.2
Delete statements
Example: Delete from products where productID=70
Microcomputers and applications
DATA DICTIONARIES
They are used for development purposes and they consist of a spreadsheet that includes the names of the fields and a description of their purpose in the database.