Object Relational SQL Data Definition - PowerPoint PPT Presentation

1 / 3
About This Presentation
Title:

Object Relational SQL Data Definition

Description:

Object Relational SQL - Data Definition. New statement: create type ... member function AGE(BIRTH in date) return number is. begin ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 4
Provided by: kajajr
Category:

less

Transcript and Presenter's Notes

Title: Object Relational SQL Data Definition


1
Object Relational SQL - Data Definition
  • New statement create type
  • create type ADDRESS as OBJECT (STREET
    varchar2(50), HOUSE_NO number(5),
    CITY varchar2(30))
  • create type PERSON as OBJECT (NAME
    varchar2(50), HOME_ADDRESS ADDRESS,
    BIRTH_DATE date, member
    function AGE (BIRTH in date) return
    number)
  • Functions and procedures as attributes
  • New statement create table of lttypegt
  • create table FRIENDS of PERSON

2
Object Relational SQL Additional Features
  • Construction of object types
  • insert into FRIENDS values(Kaj A.
    Jørgensen, ADDRESS(Tranevej,48,Vo
    dskov), 1946-02-05)
  • Definition of functions and procedures
  • create type body PERSON as member function
    AGE(BIRTH in date) return number is begin
    return trunc(months_between(sysdate,BIRTH)/12)
    endend
  • Function call example
  • select avg(AGE(BIRTH_DATE)) from FRIENDS

3
Object Relational SQL Classification
  • Classification, inheritance sub types under
    super types
  • create type STUDENT as OBJECT under PERSON
    (EDUCATION varchar2(50), SEMESTER
    number)
  • create type TEACHER as OBJECT under PERSON
    (DEPT_NAME varchar2(50),
    DEPT_ADDR ADDRESS)
Write a Comment
User Comments (0)
About PowerShow.com