Presentation is loading. Please wait.

Presentation is loading. Please wait.

Module 9: Managing Schema Objects. Overview Naming guidelines for identifiers in schema object definitions Storage and structure of schema objects Implementing.

Similar presentations


Presentation on theme: "Module 9: Managing Schema Objects. Overview Naming guidelines for identifiers in schema object definitions Storage and structure of schema objects Implementing."— Presentation transcript:

1 Module 9: Managing Schema Objects

2 Overview Naming guidelines for identifiers in schema object definitions Storage and structure of schema objects Implementing data integrity using constraints Implementing business rules at the database level using triggers and sequences

3 Identifiers and Naming Object names and column names are not case sensitive in Oracle, but are sorted in the data dictionary in upper case unless forced to be case sensitive using delimiters Object and column names are stored in system catalog in the same case as specified in the DDL In Oracle and SQL Server, object names have to be unique within the same schema Defining schemas and ownership differ very slightly between Oracle and SQL Server

4 Managing Tables There is a generic table definition syntax in Oracle and SQL Server There are various types of tables in Oracle and SQL Server Components of column definition are column name, data type, default value and constraints (optional)

5 Managing Constraints Types of constraints found in Oracle and SQL Server are: NOT NULL CHECK UNIQUE PRIMARY KEY FOREIGN KEY Constraints can be defined in-line with column definition or out-of-line as table constraints Constraints on single columns can be defined as column constraints or table constraints, and multi-column constraints are defined as table constraints Primary key constraints are enforced using unique indexes and NOT NULL constraints in both Oracle and SQL Server

6 Demonstration 1: Referential Integrity via Constraints In this demonstration you will see how to: Define a table with a Primary Key Validate with Foreign Keys Insert data and view an exception and a success

7 Managing Triggers SQL Server INSTEAD OF triggers similar to BEFORE triggers in Oracle SQL Server triggers are at the statement level Oracle uses – pseudo-row structures :new and :old SQL Server - pseudo-tables DELETED and INSERTED Unlike Oracle, SQL Server can define First and Last Trigger in a set.

8 Demonstration 2: Referential Integrity via Triggers In this demonstration you will see how to: Define a trigger Validate and auto commit or rollback transaction (insert)

9 Managing Indexes Unique and non-unique non-clustered B-tree indexes are found in both Oracle and SQL Server SQL Server clustered indexes are similar to Oracle index-organized tables SQL Server indexes can be created, dropped, rebuilt, or reorganized offline or online SQL Server provides indexing on XML and Spatial data types

10 Demonstration 3: Create and Maintain Indexes In this demonstration you will see how to: Create an Included Index with SSMS Compare execution plans and results Create the Included Index with T-SQL Rebuild the Index

11 Demonstration 4: Partitioned Index In this demonstration you will see how to: Define a partition function Define a partition scheme Assign an Index to a partition scheme Rebuild an Index for a single partition

12 Managing Views Oracle views can be created even with lack of permissions or absence of the base objects, using FORCE clause In SQL Server definition of the view can be stored in “encrypted” form in the system catalog Oracle views can be defined with constraints and can be read-only WITH CHECK OPTION is found in both DBMSs

13 Review We learned how Oracle and SQL Server differ in the interpretation of identifier names in schema object definitions We compared types of tables and indexes found in Oracle and SQL Server and learned how to create and maintain them We went over the differences in selection of storage parameters between Oracle and SQL Server We compared other schema objects in Oracle and SQL Server such as constraints, triggers, views and sequences and learned how to manage them


Download ppt "Module 9: Managing Schema Objects. Overview Naming guidelines for identifiers in schema object definitions Storage and structure of schema objects Implementing."

Similar presentations


Ads by Google