database design and management cptg 424. 10/23/2015chapter 12 of 38 functions of a database store...

39
Database Design Database Design and Management and Management CPTG 424 CPTG 424

Upload: dinah-phillips

Post on 03-Jan-2016

230 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

Database Design and Database Design and ManagementManagement

CPTG 424CPTG 424

Page 2: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 22 of 38 of 38

Functions of a DatabaseFunctions of a Database

Store dataStore data School: student records, class schedules, School: student records, class schedules,

enrollment information.enrollment information. Manufacturer: customer orders, employee data, Manufacturer: customer orders, employee data,

sales data, revenue data, profit data, supply sales data, revenue data, profit data, supply sources, product inventory.sources, product inventory.

Query the dataQuery the data Categorize and sort dataCategorize and sort data

Page 3: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 33 of 38 of 38

Functions of a DatabaseFunctions of a Database

Track processesTrack processes Analyze performanceAnalyze performance

Analyze customer behaviorAnalyze customer behavior Predict future sales and business patternsPredict future sales and business patterns Help make decisionsHelp make decisions

Page 4: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 44 of 38 of 38

Information CenterInformation Center

The database is used as the information center The database is used as the information center of business.of business.

One of the most important parts of a business One of the most important parts of a business process.process.

Page 5: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 55 of 38 of 38

To successfully set up a business, we need to To successfully set up a business, we need to have a thorough understanding of:have a thorough understanding of: Your business process.Your business process. The technologies involved in database The technologies involved in database

development and management.development and management. Database theories and technologiesDatabase theories and technologies

Page 6: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 66 of 38 of 38

Database Management SystemDatabase Management System

Even small amount of data is very hard to Even small amount of data is very hard to manipulate by hand.manipulate by hand.

Database Management System (DBMS) Database Management System (DBMS) Software to store, manage, and analyze data.Software to store, manage, and analyze data.

Page 7: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 77 of 38 of 38

DBMS Managing ToolsDBMS Managing Tools

Database configurationDatabase configuration Database administrationDatabase administration Executing query operationsExecuting query operations Creating database componentsCreating database components Defining relationships among database components.Defining relationships among database components. Data transformationData transformation DebuggingDebugging Networking utilities for a client/server environment.Networking utilities for a client/server environment.

Page 8: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 88 of 38 of 38

Popular Relational DatabasesPopular Relational Databases

Microsoft AccessMicrosoft Access Microsoft SQL ServerMicrosoft SQL Server OracleOracle MySQL (MySQL (www.mysql.com))

Page 9: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 99 of 38 of 38

MySQLMySQL

We will use MySQL for our DBMS.We will use MySQL for our DBMS. The world's most popular open source The world's most popular open source

database.database. Easy to use.Easy to use. Complex enough to handle most of the Complex enough to handle most of the

enterprise-level database tasks.enterprise-level database tasks. Free.Free. Easy installation.Easy installation.

Page 10: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 1010 of 38 of 38

SQLSQL

Structured Query Language (SQL)Structured Query Language (SQL) A standard interactive and programming language for A standard interactive and programming language for

querying, modifying data and managing databases.querying, modifying data and managing databases. The core of SQL is formed by a command language The core of SQL is formed by a command language

that allows the retrieval, insertion, updating, and that allows the retrieval, insertion, updating, and deletion of data, and performing management and deletion of data, and performing management and administrative functions.administrative functions.

Both an ANSI and ISO standard, but many database Both an ANSI and ISO standard, but many database products often has proprietary extensions.products often has proprietary extensions.

Page 11: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 1111 of 38 of 38

SQL Query LanguageSQL Query Language

To effectively retrieve data, a DBMS uses a To effectively retrieve data, a DBMS uses a query language to select only those data query language to select only those data requested by the user.requested by the user. SELECT * FROM AUTHORSSELECT * FROM AUTHORS

Page 12: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 1212 of 38 of 38

XMLXML

Integrated programming language to extend Integrated programming language to extend the DBMS’ data management ability.the DBMS’ data management ability.

Page 13: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 1313 of 38 of 38

Data AnalysisData Analysis

Tools for analyzing data.Tools for analyzing data.

Page 14: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 1414 of 38 of 38

Data MiningData Mining

Data-mining tools are used to analyze patterns Data-mining tools are used to analyze patterns of business data.of business data.

The patterns can be used to model the The patterns can be used to model the behavior of business processes.behavior of business processes.

Page 15: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 1515 of 38 of 38

MetadataMetadata

Metadata services to manage the structure and Metadata services to manage the structure and the meaning of data.the meaning of data.

Metadata are also called the data about data.Metadata are also called the data about data. Metadata are normally stored in a specific Metadata are normally stored in a specific

table called a table called a system tablesystem table.. You can use metadata to find all the tables that You can use metadata to find all the tables that

contain specific data types, such as Date, or all contain specific data types, such as Date, or all the columns that have specific names.the columns that have specific names.

Page 16: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 1616 of 38 of 38

SecuritySecurity

A database must have a dependable security A database must have a dependable security system.system.

User authentication.User authentication. Information encryption.Information encryption.

Page 17: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 1717 of 38 of 38

Data Transformation ServicesData Transformation Services

Once a database table is created, it will be Once a database table is created, it will be populated with data.populated with data.

Tools for copying data between data sources Tools for copying data between data sources such as databases, spreadsheets and text files.such as databases, spreadsheets and text files.

Page 18: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 1818 of 38 of 38

Backup and RestoreBackup and Restore

Tools for backup and restore of databaseTools for backup and restore of database Either partial or full.Either partial or full. User interface, ease of data access.User interface, ease of data access.

Page 19: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 1919 of 38 of 38

User InterfaceUser Interface

Clean user interfaceClean user interface User friendlyUser friendly Ease of data accessEase of data access Logical positioning of informationLogical positioning of information

Who can best provide information about the user Who can best provide information about the user interface?interface?

Page 20: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 2020 of 38 of 38

Database ComponentsDatabase Components

Tables.Tables. Diagrams.Diagrams. Views.Views. Stored procedures.Stored procedures. TriggersTriggers Indexes.Indexes. Users.Users. Roles.Roles. Rules.Rules.

Page 21: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 2121 of 38 of 38

TablesTables

Data are stored in tables.Data are stored in tables. Each table is used to store data related to the Each table is used to store data related to the

same object such as student.same object such as student. A table is constructed with columns and rows.A table is constructed with columns and rows. Each column represents an attribute that is Each column represents an attribute that is

used to describe the object.used to describe the object.

Page 22: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 2222 of 38 of 38

DiagramsDiagrams

Most relational databases have multiple tables.Most relational databases have multiple tables. To make the tables work together, To make the tables work together,

relationships must be correctly established relationships must be correctly established among these tables.among these tables.

This is a task of database design.This is a task of database design. A diagram is a convenient tool for creating the A diagram is a convenient tool for creating the

relationships.relationships.

Page 23: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 2323 of 38 of 38

ViewsViews

Sometimes an application (such as a form or a Sometimes an application (such as a form or a report) needs data from selected columns from report) needs data from selected columns from multiple tables.multiple tables.

A A viewview is a database component that is is a database component that is constructed to contain the data from a set of constructed to contain the data from a set of selected columns from one or more tables. selected columns from one or more tables.

Page 24: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 2424 of 38 of 38

Stored ProceduresStored Procedures

Sometimes you may want to let a DBMS run a Sometimes you may want to let a DBMS run a set of SQL statements to accomplish a task.set of SQL statements to accomplish a task.

A A stored procedurestored procedure is a precompiled set of is a precompiled set of SQL statements stored in a database server.SQL statements stored in a database server.

The processing of a database can be faster if The processing of a database can be faster if the often-used tasks are programmed as stored the often-used tasks are programmed as stored procedures.procedures.

Page 25: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 2525 of 38 of 38

TriggersTriggers

A A triggertrigger is a specific kind of stored is a specific kind of stored procedure.procedure.

It is executed automatically when a specific It is executed automatically when a specific database action occurs.database action occurs.

For example, when a table is modified by For example, when a table is modified by inserting a new record.inserting a new record.

Page 26: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 2626 of 38 of 38

IndexesIndexes

To speed up the search for specified data, a To speed up the search for specified data, a DBMS provides a component called an DBMS provides a component called an indexindex..

By using an index, the search will look only at By using an index, the search will look only at an appropriate column to match a given index an appropriate column to match a given index key.key.

Page 27: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 2727 of 38 of 38

UsersUsers

The The useruser component defines users in a component defines users in a database.database.

Many users may share the same database Many users may share the same database object, such as a table.object, such as a table.

Each user account can be configured to have Each user account can be configured to have ownerships and permissions on the objects.ownerships and permissions on the objects.

Page 28: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 2828 of 38 of 38

RolesRoles

When a group of users performs the same kind When a group of users performs the same kind of job, you can create a role and grant of job, you can create a role and grant appropriate permissions to that role.appropriate permissions to that role.

The The rolerole component allows you to group users component allows you to group users with the same set of permissions.with the same set of permissions.

Page 29: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 2929 of 38 of 38

ConstraintsConstraints

ConstraintsConstraints are used to specify characteristics are used to specify characteristics of data in a column. There are integrity of data in a column. There are integrity constraints and value constraints.constraints and value constraints.

Integrity constraintsIntegrity constraints are used to define are used to define relationships among tables.relationships among tables.

Value constraintsValue constraints allow a user to specify, for allow a user to specify, for example, if a column can take a NULL value, example, if a column can take a NULL value, or if the value should be unique.or if the value should be unique.

Page 30: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 3030 of 38 of 38

RulesRules

RuleRule components are used to restrict values components are used to restrict values entered in a column.entered in a column.

Rules specify the range of valid values that Rules specify the range of valid values that can be entered into a column.can be entered into a column.

Page 31: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 3131 of 38 of 38

DefaultsDefaults

DefaultsDefaults specify the default value in a column. specify the default value in a column.

Page 32: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 3232 of 38 of 38

User-DefinedUser-Defined

Can create user-defined database objects such Can create user-defined database objects such as user-defined data types.as user-defined data types.

Page 33: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 3333 of 38 of 38

Database Development ProcessDatabase Development Process

Before a database can be built…Before a database can be built… Need to understand how the database will Need to understand how the database will

achieve its goals.achieve its goals. Whether it will solve your specified problems.Whether it will solve your specified problems. A well-designed database is based on a good A well-designed database is based on a good

understanding of the business process.understanding of the business process.

Page 34: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 3434 of 38 of 38

Database Development ProcessDatabase Development Process

Step 1 – Identify business requirements and Step 1 – Identify business requirements and goals to be achieved.goals to be achieved.

Gather information from users.Gather information from users.

Page 35: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 3535 of 38 of 38

Step 1: Gather InformationStep 1: Gather Information

What are the business requirements for the What are the business requirements for the future database?future database?

What information needs to be stored in the What information needs to be stored in the database?database?

How can the data be stored?How can the data be stored? How can the data be presented to the end How can the data be presented to the end

users?users? Need to prepare the agreements and contracts.Need to prepare the agreements and contracts. The timeline to fulfill those agreements.The timeline to fulfill those agreements.

Page 36: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 3636 of 38 of 38

Step 2: Data ModelStep 2: Data Model

Once you have figured out what information Once you have figured out what information you want to store and keep track of, the next you want to store and keep track of, the next step is to understand the step is to understand the relationshipsrelationships among among the data.the data.

Use the data modeling process.Use the data modeling process. Translate the data model to database tables Translate the data model to database tables

with integrity constraints.with integrity constraints. Specify the tables and columns to organize the Specify the tables and columns to organize the

business data into a well-defined structure.business data into a well-defined structure.

Page 37: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 3737 of 38 of 38

Step 2: Data ModelStep 2: Data Model

Need to make sure that the database design Need to make sure that the database design team and their business partners are all team and their business partners are all satisfied.satisfied.

Usually several modifications are needed.Usually several modifications are needed.

Page 38: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 3838 of 38 of 38

Step 3: ImplementationStep 3: Implementation

Implement the database with a DBMS Implement the database with a DBMS package.package.

Choose a proper DBMS package.Choose a proper DBMS package. Create the tables.Create the tables. Populate them with data.Populate them with data. Test the newly created databaseTest the newly created database Create user interfaces.Create user interfaces.

Page 39: Database Design and Management CPTG 424. 10/23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,

04/20/2304/20/23 Chapter 1Chapter 1 3939 of 38 of 38

Step 3: ImplementationStep 3: Implementation

Different ways of accessing the database:Different ways of accessing the database: One computer.One computer. Local network.Local network. Via the internet. Network database or Web database.Via the internet. Network database or Web database. Simultaneous access for millions of users.Simultaneous access for millions of users. Database may not fit into a single computer.Database may not fit into a single computer. Database must be partitioned into multiple parts, and Database must be partitioned into multiple parts, and

the partitioned database is distributed to multiple the partitioned database is distributed to multiple computers – computers – distributed databasedistributed database..