INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Application Development For DBA’s Lecture 8 Copyright System Managers LLC 2007 all rights reserved.

Slides:



Advertisements
Similar presentations
9 Copyright © 2004, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
Advertisements

Creating Tables. 2 home back first prev next last What Will I Learn? List and provide an example of each of the number, character, and date data types.
McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. Extended Learning Module C Designing Databases and Entity-Relationship.
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
Introduction To SQL Lynnwood Brown President System Managers LLC Copyright System Managers LLC 2003 all rights reserved.
ETEC 100 Information Technology
Oracle8 - The Complete Reference. Koch & Loney1 Chapter 17 Creating, Dropping, and Altering Tables and Views Presented by Victor Matos.
SQL Components DML DDL DAL. Overview u Getting the records onto the disk - mapping u Managing disk space u SQL Modes u Ceating database.
Extended Learning Module C Designing Databases and Entity-Relationship Diagramming McGraw-Hill/Irwin Copyright © 2010 by the McGraw-Hill Companies, Inc.
Copyright  Oracle Corporation, All rights reserved. 9 Manipulating Data: INSERT, UPDATE, DELETE.
Data Modelling. EAR model This modelling language allows a very small vocabulary: Just as English has nouns, verbs, adjectives, pronouns.., EAR models.
Access Lecture 1 Database Overview and Creating Tables Create an Employee Table.
Transforming Data Models into Database Designs
1 Nassau Community CollegeProf. Vincent Costa Acknowledgements: Introduction to Database Management, All Rights ReservedIntroduction to Database Management.
Database Systems Lecture 5 Natasha Alechina
Oracle Data Definition Language (DDL)
Database Lecture # 1 By Ubaid Ullah.
IE 423 – Design of Decision Support Systems Database development – Relationships and Queries Introduction to SQL.
I Copyright © 2004, Oracle. All rights reserved. Introduction.
Copyright  Oracle Corporation, All rights reserved. I Introduction.
RDB/1 An introduction to RDBMS Objectives –To learn about the history and future direction of the SQL standard –To get an overall appreciation of a modern.
Copyright  Oracle Corporation, All rights reserved. 4 CMIS Powell Oracle Designer: Creating the Database Design CMIS Powell.
4-1 Copyright  Oracle Corporation, All rights reserved. Data Manipulation Language (DML)
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC End User Management – Lecture 3 Copyright System Managers LLC 2007 all rights reserved.
Oracle Data Definition Language (DDL) Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
SQL Structured Query Language Programming Course.
10 Copyright © 2009, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
1 Copyright © 2006, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
Copyright © 2004, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
Unit 6 Data Storage Design. Key Concepts 1. Database overview 2. SQL review 3. Designing fields 4. Denormalization 5. File organization 6. Object-relational.
10 Creating and Managing Tables Objectives At the end of this lesson, you will be able to: Describe the main database objects Create tables Describe.
10-1 Copyright  Oracle Corporation, All rights reserved. Database Objects ObjectDescription TableBasic unit of storage; composed of rows and columns.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
CN2180 MS SQL Server Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP.
Session 2: SQL (A): Parts 1 and 2 Original materials supplied by the Oracle Academic Initiative (OAI). Edited for classroom use by Professor Laku Chidambaram.
Chapter 3 Selected Single-Row Functions and Advanced DML & DDL.
11-1 Copyright  Oracle Corporation, All rights reserved. What Are Constraints? Constraints enforce rules at the table level. Constraints prevent.
Database Lab Lecture 1. Database Languages Data definition language ( DDL ) Data definition language –defines data types and the relationships among them.
Copyright  Oracle Corporation, All rights reserved. 11 Including Constraints.
Copyright  Oracle Corporation, All rights reserved. Introduction.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
SQL: Part 1 Original materials supplied by the Oracle Academic Initiative (OAI). Edited for classroom use by Professor Laku Chidambaram. Not for commercial.
9 Copyright © 2004, Oracle. All rights reserved. Using DDL Statements to Create and Manage Schema Objects.
11 Including Constraints Objectives At the end of this lesson, you will be able to: Describe constraints Create and maintain constraints At the.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
IS 380 Introduction to SQL This lectures covers material from: database textbook chapter 3 Oracle chapter: 3,14,17.
Foundations of Business Intelligence: Databases and Information Management.
INTRODUCTION TO ORACLE DATABASE ADMINISTRATION Lynnwood Brown President System Managers LLC Introduction – Lecture 1 Copyright System Managers LLC 2003.
13 Copyright © Oracle Corporation, All rights reserved. Maintaining Data Integrity.
An Introduction To SQL Part 2 (Special thanks to Geoff Leese)
1 Information Retrieval and Use (IRU) An Introduction To SQL Part 2.
9-1 © Prentice Hall, 2007 Topic 9: Physical Database Design Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Indexes- What?  Optional structures associated with tables  Provides a quick access path to table data  You can create indexes on one or more columns.
Creating and Managing Tables 14. ObjectivesObjectives After completing this lesson, you should be able to do the following: After completing this lesson,
Copyright س Oracle Corporation, All rights reserved. 12 Creating Views.
Chapter 3: Relational Databases
Chapter 11: Physical Database Design Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A. Hoffer.
CSCI N311: Oracle Database Programming 5-1 Chapter 15: Changing Data: insert, update, delete Insert Rollback Commit Update Delete Insert Statement –Allows.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. A database is a collection of information organized to provide efficient retrieval. The collected information.
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
CDT/1 Creating data tables and Referential Integrity Objective –To learn about the data constraints supported by SQL2 –To be able to relate tables together.
SQL Statements SELECT INSERTUPDATEDELETECREATEALTERDROPRENAMETRUNCATECOMMITROLLBACKSAVEPOINTGRANTREVOKE Data Retrieval Language (DRL) Data Retrieval Language.
Including Constraints
Database Systems Instructor Name: Lecture-12.
Translation of ER-diagram into Relational Schema
ORACLE SQL Developer & SQLPLUS Statements
Teaching slides Chapter 8.
Oracle Data Definition Language (DDL)
Presentation transcript:

INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Application Development For DBA’s Lecture 8 Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPEMENT Entity-Relationship Modeling The ER model provides the framework for understanding how the application should be written. Models can be changed quickly Models show the alternatives to satisfying a business requirement Model can be used to estimate system capacity requirements

APPLICATION DEVELOPEMENT ER modeling is a graphical technique for capturing business information and the relationships between the data. ER models consist of: Entities - The things of significance about the information that is held. Entities often become the tables or views that a application will use Relationships - Describe how the entities Rae related. The different types of relationships include one to one (1:1), one to many (1:M), many to one (M:1), many to many (M:M) and optional relationships. Attributes - The specific information that describes the entity. Attributes often become the columns in the tables. An attribute can be mandatory (must always have a value - *), optional (can be NULL - o) or unique (#).

APPLICATION DEVELOPMENT ER Model Components Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPMENT One To One Relationships Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPMENT One To Many Relationships Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPMENT My name is K.E. Nell. I am the owner and operator of KEN’s Kennel. At KEN’s Kennel we board pets while their owners are out of town. When the owner brings in their pet we obtain the name of the owner, the name of each pet, the age f each pet and the pets weight, species, gender, color and breed. We also need information about the customer. We need their name, address, home phone, their veterinarian’s name and phone number, and when they will be returning for the pet. Each pet, I house in a very spacious kennel suite during his or her stay. The larger pets reside in a 30 x 20 foot kennel and the smaller pets get a nice cozy 10 x 5 foot kennel suite. For the pets safety and comfort only one pet is placed into a kennel suite at a time. Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPMENT In the narrative we must first find the entities or “things of significance”. The characteristics of an entity include: An entity is an object of interest/significance to the business An entity is a noun An entity is a category or class Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPMENT ER Model Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPMENT Implementing Business Rules Business rules are implemented by using constraints. The different types of constraints include: Primary Key Constraint – All column values must be unique and not null Unique Constraint – All column values must be unique Not Null Constraint – No column data can contain a NULL (a value must be supplied) Foreign Key Constraint – The values of the column data in one table (child) must first exist in another table (parent) Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPMENT Implementing Business Rules Creating a primary key constraint Creating a primary key constraint at table creation time: SQL > CREATE TABLE EMP (EMPNO NUMBER PRIMARY KEY, ENAME VARCHAR2(20), …..); Creating a primary key constraint after the table has been created: SQL > ALTER TABLE EMP ADD PRIMARY KEY (EMPNO); Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPMENT Implementing Business Rules Creating a unique constraint Creating a unique constraint at table creation time: SQL > CREATE TABLE EMP (DEPTNO NUMBER, DEPT_NAME VARCHAR2(10) CONSTRAINT UN_NAME UNIQUE, …); Creating a unique constraint after the table has been created: SQL > CREATE UNIQUE INDEX ON DEPT (DEPT_NAME); Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPMENT Implementing Business Rules Creating a not null constraint Creating a not null constraint at table creation time: SQL > CREATE TABLE EMP (EMPNO NUMBER, ENAME VARCHAR2(20) NOT NULL, …..); Creating a not null constraint after the table has been created: SQL > ALTER TABLE EMP MODIFY (SAL NUMBER CONSTRAINT MY_EMP_CON NOT NULL; Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPMENT Implementing Business Rules Creating a foreign key constraint Creating a foreign key constraint at table creation time: SQL > CREATE TABLE EMP (EMPNO NUMBER, ENAME, VARCHAR2(20),. DEPTNO NUMBER CONSTRAINT FKEY_DEPT REFERENCES DEPT(DEOTNO)); Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPMENT Implementing Business Rules Creating a foreign key constraint Creating a foreign key constraint after the table has been created: SQL > ALTER TABLE EMP ADD CONSTRAINT FKEY_DEPT FOREIGN KEY (DEPTNO) REFERENCES DEPT(DEPTNO); Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPMENT Implementing Business Rules Data Dictionary Constraint Views The following data dictionary views are used to keep track of constraints that have been defined: DBA_CONSTRAINTS – Constraint definitions (OWNER, TYPE ETC…) DBA_CONS_COLUMNS – Name of the column in the constraint definition Copyright System Managers LLC 2007 all rights reserved.

APPLICATION DEVELOPMENT Estimating Table Size Table Field Sizes: Date fields = 7 bytes Character fields = 1 byte per character Number of bytes for numerical fields = precession/2 + 1 Create Table TEST (EMPNO NUMBER(4) ENAME VARCHAR2(15), HIRE_DATE DATE, SAL NUMBER(7,2)); Record Size = (4/2+1) (7/2+1) = 28.5 bytes

APPLICATION DEVELOPMENT Estimating Tablespace Extent Sizes Place like sized tables in their own tablespace: Small tables and indexes MB and smaller –Tablespace INITIIAL and NEXT Extent Size = 128KB Medium sized tables and indexes - 128MB to 4GB –Tablespace INITIIAL and NEXT Extent Size = 4MB Large tables and indexes - 4 GB and higher –Tablespace INITIIAL and NEXT Extent Size = 4MB This is done to reduce tablespace fragmentation Copyright System Managers LLC 2007 all rights reserved.

REPLICATION Replication – Used to copy of one or more tables from one database to another. Simple Replication - One way replication using the SNAPSHOT feature Oracle Advanced Replication - Uses the Oracle supplied package DBMS_REPCAT to implement two way or master to master replication Uses the SNP background process on the primary machine to replicate the data to the secondary server Used to populate a report server or data warehouse

REPLICATION cont. Simple Replication – Replication (secondary) site database setup to replicate the “emp” table: Create the snapshot (replicate the table): SQL > create snapshot emp SQL > refresh fast SQL > start with sysdate SQL > next (sysdate+1) + 03/24 /* refresh every 24 hours. at 3:00 AM */ SQL > as select * from REFRESH = FAST – For Incremental table updates REFRESH = COMPLETE – For a complete table update.

APPLICATION DEVELOPMENT Summary: Use ER modeling to determine the applications base tables and the relationships between them Use database constraints to implement business rules Determine the amount of data that must be stored Size data and index tablespace extents according to the size of the objects that will be stored in them Copyright System Managers LLC 2007 all rights reserved.