next up previous contents
Next: Rules Up: Sybase 11 Database Previous: Sybase 11 Database

Table and View Definitions

Sybase 11 tables definitions generated from the OPM schema shown in section 3 are contained in file Example_relations.SYB11:

create database Example on default = 10
go
use Example
go
sp_addtype Rank, "varchar(255)"
go
sp_addtype Salary, "int"
go
create table CLASSES (
        _cid int not null,
        _dbid int null,
        _alias varchar(80) null,
        _classDescr varchar(255) null,
        _className varchar(32) not null,
        _type varchar(20) not null
)
go
create table COURSE (
        _defaultVersion int null,
        _nextVersion int null,
        _oid numeric(10,0) not null,
        courseNumber char(10) not null,
        name varchar(80) null
)
go
create table COURSE_references (
        _aid numeric(10,0) identity not null,
        _oid numeric(10,0) not null,
        _version int not null,
        references numeric(10,0) not null
)
go
create table DATABASES (
        _dbid int not null,
        _dbDescr varchar(255) null,
        _dbName varchar(80) not null
)
go
create table DEPARTMENT (
        _oid numeric(10,0) not null,
        name int not null
)
go
create table DepartmentNames (
        _code int not null,
        _defn varchar(255) null,
        _value varchar(255) not null
)
go
create table FACULTY (
        _defaultVersion int null,
        _nextVersion int null,
        _oid numeric(10,0) not null,
        department numeric(10,0) null,
        rank Rank null
)
go
create table OBJECTS (
        _oid numeric(10,0) identity not null
)
go
create table PERSON (
        _oid numeric(10,0) not null,
        name varchar(50) null,
        ssn int not null
)
go
create table REFERENCE (
        _foreignOid varchar(255) not null,
        _oid numeric(10,0) not null
)
go
create table SCLASSES (
        _class int not null,
        _subclass int null
)
go
create table STUDENT (
        _defaultVersion int null,
        _nextVersion int null,
        _oid numeric(10,0) not null
)
go
create table STUDENT_attends (
        _aid numeric(10,0) identity not null,
        _oid numeric(10,0) not null,
        _vcourse int null,
        _version int not null,
        course numeric(10,0) null,
        inDepartment numeric(10,0) null
)
go
create table _vCOURSE (
        _deleteDate datetime null,
        _fromDate datetime not null,
        _oid numeric(10,0) not null,
        _preVersion int null,
        _version int not null
)
go
create table _vFACULTY (
        _deleteDate datetime null,
        _fromDate datetime not null,
        _oid numeric(10,0) not null,
        _preVersion int null,
        _version int not null,
        salary Salary null
)
go
create table _vSTUDENT (
        _deleteDate datetime null,
        _fromDate datetime not null,
        _oid numeric(10,0) not null,
        _preVersion int null,
        _version int not null
)
go
create view PROFESSOR ( _oid ) as
       select _oid from FACULTY
       where rank = "Professor"
go
quit