DB2 - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

DB2 Schema

DB2 Schema

shape Description

DB2 SchemaS is a relevant capsule for data structures. A database client account has a user name and password and having exact database privileges. Each account of a client reserves a individual schema, and contain similar term as of the client. Tables and indexes are the examples of DB2 Schema objects. Schema objects manipulate and creates schema through SQL. The DB2 Schema holds the information for the client containing the schema. For instance, the manager account reserves the manager schema, in these schema items are present in the manner to employee table. Each schema object has a unique name. i.e, manager employee refers to the table employee in the manager schema.

shape Conceptual figure

Common DB2 Database Objects

shape Description

DB2 Database schema object contain the following types 

Schema object types

shape Description

DB2 database allows to generate and mould different forms of schema items. The succeeding are the sorts of schema items.
  • Tables
  • Partitions
  • Index
  • Sequences
  • Views
  • Dimensions

Tables

Tables are the most crucial schema items in the comparative database. A table holds the information values in a row.

Partitions

Partitions are data items of huge set of indexes and tables. Every allotment has a unique term name and contain individual repository components.

Index

These are schema items that consists of an entry for every indexed row of the table.
  • Index gives explicit executions to rows.
  • Database backing with multiple sorts of index.
  • Organised table data is stored in the index structure.

sequences

Is a client-oriented item, so can be manually distributed to different number of clients to develop integers.

Views

Views is a personalized presentation of data in many tables. Views doesn't  contain any data.

Dimensions

The dimensions describes, parent and child affairs among combination of column arrangements. Position of all the columns in the column arrangements will be defined within the equivalent table. The measures are generally used to describe information like purchaser, item and accessions.

Schema object dependencies

shape Description

Few sorts of schema items can be referred through different items. For instance, a view can be termed as a query and refers to tables, contain the body of sub-program that includes SQL statements and can refer to other objects. DB2 database contributes an automated tool to assure that a inferior item is constantly updated with regard to its specified items. While creating a specified item, the database marks the dependency among the referred objects and the dependent object. While a referred object alters the way that control the constantly item, the database imprints the constantly item as baseless.

shape Syntax

create table <test_table>(column_name1 int,column_name2 interger); create or replace procedure test_proc As Begin for x in(select column_name1,column_name2 from test_table) loop --process data null; end loop; end; Test_table => The accurate table name in the database Test_proc => The accurate table name in the database Column_name => The names inserted in the column

Sample Schema

shape Description

DB2 database contain a set of schema called sample schemas, that are interlaced schemas and implements DB2 authentication and didactic components to explain similar database operations. The manager schema contain a sample schema and consists data about an employee, administration and area. Employee contain employee-id, first-name, last-name, email-id. Administration contain dept_id,dept_name and area contains city, street and postal code.

Schema object storage

shape Description

Schema objects storage is a type of logical storage structure called a segment. Database saves a schema item inside table space and no communication exits among the table spaces and schemas. A table space contains items against distant schemas, and the objects for a schema can be enclosed in various table spaces. For example, a non_partition heap-organize table are an index created segments. Further schema items, functioning as views and sequences, consists of only metadata.

System and SYS schema

shape Description

All the DB2 databases contain by_default administrative accounts. This administrative accounts are exceptionally having high privileges endure designed based on DBAs to access particular operations like start and stop  database, manage the storage and memory, generating and guiding database clients. The SYS legislative reports get generated while the database account is generated. This reports will function all database legislative resources. The SYS schema holds the common tables values in the table. These common views and tables plays a major role in Oracle Database. Tables in the SYS schema will alter or modify the database and user cannot modify the database as user will have only restricted privileges.

Summary

shape Key Points

  • DB2 Schema - Database schema contains a coherent capsule called information design.
  • Schema object type - Creates and manipulates the objects.
  • Schema object dependencies - Schemas that defines in the table are called object dependencies.
  • Sample schemas - This are inter linked schemas.
  • Schema object storage - Stores index and segments values.
  • System and SyS schemas - This schemas are the privileges for system administrator.