Refining the Server Model. Adding New Tables New Table New View New Snapshot New Cluster New Column New Man FK New Opt FK.

Slides:



Advertisements
Similar presentations
9 Creating and Managing Tables. Objectives After completing this lesson, you should be able to do the following: Describe the main database objects Create.
Advertisements

Data Definition Language (DDL)
BACS 485—Database Management Advanced SQL Overview Advanced DDL, DML, and DCL Commands.
1 © 2006 Julian Dyke Supplemental Logging Julian Dyke Independent Consultant juliandyke.com Web Version.
Manipulating Data Schedule: Timing Topic 60 minutes Lecture
1 SQL Server Management Studio SQL DDL CREATE TABLE Constraints ALTER TABLE DROP TABLE The GUI way Steen Jensen, autumn 2013.
Virtual training week 4 structured query language (SQL)
Database Programming Sections 13. Marge Hohly  1. Which statements are True about the following sequence? The sequence was used to generate numbers.
10 Copyright © 2004, Oracle. All rights reserved. Creating Other Schema Objects.
SQL components In Oracle. SQL in Oracle SQL is made up of 4 components: –DDL Data Definition Language CREATE, ALTER, DROP, TRUNCATE. Creates / Alters.
Database Constraints. Database constraints are restrictions on the contents of the database or on database operations Database constraints provide a way.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 Part 2: File Organization and Performance Modern Database Management 10 th Edition.
Oracle Data Block Oracle Concepts Manual. Oracle Rows Oracle Concepts Manual.
Chapter 6 Additional Database Objects
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.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Other database objects (Sequence). What Is a Sequence? A sequence: Automatically generates sequential numbers Is a sharable object Is typically used to.
11 Copyright © 2007, Oracle. All rights reserved. Creating Other Schema Objects.
Chapter 6 Additional Database Objects Oracle 10g: SQL.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
SQL Server Indexes Indexes. Overview Indexes are used to help speed search results in a database. A careful use of indexes can greatly improve search.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Introduction to Relational Databases &
© Pearson Education Limited, Chapter 13 Physical Database Design – Step 4 (Choose File Organizations and Indexes) Transparencies.
10 Copyright © Oracle Corporation, All rights reserved. Including Constraints.
Nitin Singh/AAO RTI ALLAHABAD 1 SQL Nitin Singh/AAO RTI ALLAHABAD 2 OBJECTIVES §What is SQL? §Types of SQL commands and their function §Query §Index.
Database Programming Sections 11 & 12 – Creating, and Managing Views, Sequences, Indexes, and Synonymns.
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.
ITBIS373 Database Development Lecture 3a - Chapter 3: Using SQL Queries to Insert, Update, Delete, and View Data.
SQL Basics. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases.
10 Copyright © Oracle Corporation, All rights reserved. Including Constraints.
Database Lab Lecture 1. Database Languages Data definition language ( DDL ) Data definition language –defines data types and the relationships among them.
SQL for Database Construction and Application Processing
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.
DBSQL 5-1 Copyright © Genetic Computer School 2009 Chapter 5 Structured Query Language.
06 | Modifying Data in SQL Server Brian Alderman | MCT, CEO / Founder of MicroTechPoint Tobias Ternstrom | Microsoft SQL Server Program Manager.
Database Programming Sections 11 & 12 –Sequences, Indexes, and Synonymns.
Copyright © 2004, Oracle. All rights reserved. Using the Set Operators.
University of Sunderland COM 220 Lecture Ten Slide 1 Database Performance.
Copyright  Oracle Corporation, All rights reserved. 12 Creating Views.
Chapter 5 Index and Clustering
Session 1 Module 1: Introduction to Data Integrity
Chapter 4 Indexes. Indexes Logically represents subsets of data from one or more tables View Generates numeric valuesSequence Basic unit of storage; composed.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 9 Designing Databases 9.1.
Chapter 12 Additional Database Objects. Chapter Objectives  Define the purpose of a sequence and state how it can be used by an organization  Explain.
Altering Tables and Constraints Database Systems Objectives Add and modify columns. Add, enable, disable, or remove constraints. Drop a table. Remove.
Database Programming Sections 12 – Sequences, Indexes, and Synonymns.
Copyright س Oracle Corporation, All rights reserved. 12 Creating Views.
Chapter 3: Relational Databases
Howard Paul. Sequential Access Index Files and Data File Random Access.
Database Systems, 8 th Edition SQL Performance Tuning Evaluated from client perspective –Most current relational DBMSs perform automatic query optimization.
Microsoft Access CS 110 Fall Entity Relationship Model Entities Entities Principal data object about which information is to be collectedPrincipal.
 CONACT UC:  Magnific training   
Client/Server Databases and the Oracle 10g Relational Database
Indexes By Adrienne Watt.
The Basics of Data Manipulation
SQL Creating and Managing Tables
Interacting with the Oracle Server
SQL 101.
SQL Creating and Managing Tables
What Is a View? EMPNO ENAME JOB EMP Table EMPVU10 View
Database Fundamentals
SQL Creating and Managing Tables
The Basics of Data Manipulation
Constraints.
Chapter 4 Indexes.
CH 4 Indexes.
Primary key Introduction Introduction: A primary key, also called a primary keyword, is a key in a relational database that is unique for each record.
CH 4 Indexes.
Manipulating Data.
Presentation transcript:

Refining the Server Model

Adding New Tables New Table New View New Snapshot New Cluster New Column New Man FK New Opt FK

Add a Foreign Key

Create Index for FK DDT Automatically Creates Index for FK

Other Columns to Index Key columns Columns used frequently in queries Columns with many distinct values Guidelines: –Start with the least number of indexes –Add indexes as the data grows –Check both query and DML perfomance

Choosing the Number of Indexes More indexes = slower insert and delete Concatenated indexes can help Queries: NAME = 'SMITH'; JOB LIKE 'SALES%' AND NAME = 'SMITH'; JOB = 'CLERK' AND NAME = 'SMITH' AND HIREDATE > '1-JUN-98'; HIREDATE = '31-DEC-98'; Indexes: NAMEJOBHIREDATE NAME JOB HIREDATE

Oracle Sequence Database object: –Generates unique numbers –Minimizes contention Gaps in sequence 3 2 1

Adding Surrogate Key Create a Sequence Assign to Column Create Key

DDT Surrogate Keys Automatically creates key Automatically creates sequence Automatically assigns sequence to key column

Oracle Sequences Efficient Have Gaps –Rolled back transactions do not return used sequence numbers

Eliminating the Gaps IDENTIFIERLAST_NAME New row SMITH HAMBURG CG_CODE_CONTROLS EMPLOYEES CC_DOMAIN CC_NEXT VALUE CC_INCREMENT EMP_SEQ EMP_SEQ1 1 CC_DOMAIN CC_NEXT VALUE CC_INCREMENT EMP_SEQ EMP_SEQ1 1

Creating a Code Control Sequence Sequence Definitions Create Sequence: Name ? Name of the sequence Purpose of the sequence Sequence typeORACLE sequence Code control sequence 1 2 3

RE_IDLINE_NO RENTAL_ITEMS Sequence Within Parent RE_ID 1212 RENTALS Generate a value within the context of the parent record

Creating a Sequence Within a Parent Set AutoGen Type to Seq in Parent Column Properties Derivation Autogen Type … Seq in Parent

Choosing a Method Oracle sequence: –Sequential values with gaps –Recommended Code control sequence: –Databases other than Oracle –Sequential values without gaps –Contention can be tolerated Sequence within a parent: –Minimal number of detail records