Object-Based Databases



Similar documents
2. Conceptual Modeling using the Entity-Relationship Model

DATABASE DESIGN. - Developing database and information systems is performed using a development lifecycle, which consists of a series of steps.

OBJECT ORIENTED EXTENSIONS TO SQL

Scheme G. Sample Test Paper-I

Chapter 1: Introduction. Database Management System (DBMS) University Database Example

Databases What the Specification Says

COMP 378 Database Systems Notes for Chapter 7 of Database System Concepts Database Design and the Entity-Relationship Model

Lecture 12: Entity Relationship Modelling

Graham Kemp (telephone , room 6475 EDIT) The examiner will visit the exam room at 15:00 and 17:00.

CSCI315 Database Design and Implementation

Overview RDBMS-ORDBMS- OODBMS

There are five fields or columns, with names and types as shown above.

Exercise 1: Relational Model

IT2305 Database Systems I (Compulsory)

Chapter 9: Object-Based Databases

Object oriented design process

OBJECTS AND DATABASES. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 21

Database System Concepts

ECS 165A: Introduction to Database Systems

Java (12 Weeks) Introduction to Java Programming Language

Designing a Database Schema

IT2304: Database Systems 1 (DBS 1)

Bridge from Entity Relationship modeling to creating SQL databases, tables, & relations

LiTH, Tekniska högskolan vid Linköpings universitet 1(7) IDA, Institutionen för datavetenskap Juha Takkinen

Databases and BigData

Lesson 8: Introduction to Databases E-R Data Modeling

XV. The Entity-Relationship Model

Part 7: Object Oriented Databases

Part VI. Object-relational Data Models

In This Lecture. SQL Data Definition SQL SQL. Notes. Non-Procedural Programming. Database Systems Lecture 5 Natasha Alechina

Introduction to Databases

The Relational Model. Ramakrishnan&Gehrke, Chapter 3 CS4320 1

Object-Oriented Databases

CMU - SCS / Database Applications Spring 2013, C. Faloutsos Homework 1: E.R. + Formal Q.L. Deadline: 1:30pm on Tuesday, 2/5/2013

Databasesystemer, forår 2005 IT Universitetet i København. Forelæsning 3: Business rules, constraints & triggers. 3. marts 2005

Lecture 6. SQL, Logical DB Design

CS352 Lecture - Object-Based Databases

Database Design Overview. Conceptual Design ER Model. Entities and Entity Sets. Entity Set Representation. Keys

Database Design. Database Design I: The Entity-Relationship Model. Entity Type (con t) Chapter 4. Entity: an object that is involved in the enterprise

The Relational Model. Why Study the Relational Model? Relational Database: Definitions. Chapter 3


Review: Participation Constraints

We know how to query a database using SQL. A set of tables and their schemas are given Data are properly loaded

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013

COMPUTER SCIENCE 1999 (Delhi Board)

CSE 132A. Database Systems Principles

Object Oriented Databases. OOAD Fall 2012 Arjun Gopalakrishna Bhavya Udayashankar

Introduction to SQL for Data Scientists

Oracle For Beginners Page : 1

Information Management

How To Improve Performance In A Database

DESIGN, IMPLEMENTATION, AND MANAGEMENT DO NOT COPY PETER ROB CARLOS CORONEL

Contents RELATIONAL DATABASES

three Entity-Relationship Modeling chapter OVERVIEW CHAPTER

SQL Data Definition. Database Systems Lecture 5 Natasha Alechina

- Eliminating redundant data - Ensuring data dependencies makes sense. ie:- data is stored logically

Answer Key. UNIVERSITY OF CALIFORNIA College of Engineering Department of EECS, Computer Science Division

7. Databases and Database Management Systems

B2.2-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

USING OBJECT-RELATIONAL DATABASE TECHNOLOGY TO SOLVE PROBLEMS IN DATABASE DEVELOPMENT

Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model

Introduction to SQL ( )

A Rational Software Whitepaper

DATABASE MANAGEMENT SYSTEMS. Question Bank:

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB

Assignment 3: SQL Queries. Questions 1. The following relations keep track of airline flight information:

CSE 233. Database System Overview

THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E)

Information Systems Analysis and Design CSC John Mylopoulos Database Design Information Systems Analysis and Design CSC340

TYPICAL QUESTIONS & ANSWERS

Normalization in OODB Design

University of Massachusetts Amherst Department of Computer Science Prof. Yanlei Diao

Using Temporary Tables to Improve Performance for SQL Data Services

CIS 631 Database Management Systems Sample Final Exam

SQL Tables, Keys, Views, Indexes

Fundamentals of Database Design

Midterm Exam SOLUTION

CMPT 354 Database Systems. Simon Fraser University Summer Instructor: Oliver Schulte

Structured Query Language (SQL)

Object Oriented Databases (OODBs) Relational and OO data models. Advantages and Disadvantages of OO as compared with relational

Doing database design with MySQL

Schema Evolution in SQL-99 and Commercial (Object-)Relational DBMS

Modern Databases. Database Systems Lecture 18 Natasha Alechina

Introduction to Object-Oriented and Object-Relational Database Systems

THE OPEN UNIVERSITY OF TANZANIA FACULTY OF SCIENCE TECHNOLOGY AND ENVIRONMENTAL STUDIES BACHELOR OF SIENCE IN DATA MANAGEMENT

Outline. Data Modeling. Conceptual Design. ER Model Basics: Entities. ER Model Basics: Relationships. Ternary Relationships. Yanlei Diao UMass Amherst

Chapter 1: Introduction. Database Management System (DBMS)

B.Sc. (Computer Science) First Year

Conceptual Design Using the Entity-Relationship (ER) Model

Database Modelling in UML

Database Management Systems

VIEWS virtual relation data duplication consistency problems

IV. The (Extended) Entity-Relationship Model

1 File Processing Systems

Database Auditing Design on Historical Data

Chapter 3. Data Modeling Using the Entity-Relationship (ER) Model

Transcription:

C H A P T E R22 Object-Based Databases Practice Exercises 22.1 A car-rental company maintains a database for all vehicles in its current fleet. For all vehicles, it includes the vehicle identification number, license number, manufacturer, model, date of purchase, and color. Special data are included for certain types of vehicles: Trucks: cargo capacity. Sports cars: horsepower, renter age requirement. Vans: number of passengers. Off-road vehicles: ground clearance, drivetrain (four- or two-wheel drive). Construct an SQL schema definition for this database. Use inheritance where appropriate. For this problem, we use table inheritance. We assume that MyDate, Color and DriveTrainType are pre-defined types. create type Vehicle (vehicle id integer, license number char(15), manufacturer char(30), model char(30), purchase date MyDate, color Color) create table vehicle of type Vehicle create table truck (cargo capacity integer) create table sportscar 1

2 Chapter 22 Object-Based Databases (horsepower integer renter age requirement integer) create table van (num passengers integer) create table offroadvehicle (ground clearance real drivetrain DriveTrainType) 22.2 Consider a database schema with a relation Emp whose attributes are as shown below, with types specified for multivalued attributes. Emp = (ename, ChildrenSet multiset(children), SkillSet multiset(skills)) Children = (name, birthday) Skills = (type, ExamSet setof(exams)) Exams = (year, city) a. Define the above schema in SQL, with appropriate types for each attribute. b. Using the above schema, write the following queries in SQL. i. Find the names of all employees who have a child born on or after January 1, 2000. ii. iii. Find those employees who took an examination for the skill type typing in the city Dayton. List all skill types in the relation Emp. a. No Answer. b. Queries in SQL. i. Program: ii. Program: select ename from emp as e, e.childrenset as c where March in (select birthday.month from c )

Practice Exercises 3 iii. Program: select e.ename from emp as e, e.skillset as s, s.examset as x where s.type = typing and x.city = Dayton select distinct s.type from emp as e, e.skillset as s 22.3 Consider the E-R diagram in Figure 22.5, which contains composite, multivalued, and derived attributes. a. Give an SQL schema definition corresponding to the E-R diagram. b. Give constructors for each of the structured types defined above. a. The corresponding SQL:1999 schema definition is given below. Note that the derived attribute age has been translated into a method. create type Name (first name varchar(15), middle initial char, last name varchar(15)) create type Street (street name varchar(15), street number varchar(4), apartment number varchar(7)) create type Address (street Street, city varchar(15), state varchar(15), zip code char(6)) create table customer (name Name, customer id varchar(10), address Adress, phones char(7) array[10], dob date) method integer age() b. create function Name (f varchar(15), m char, l varchar(15)) returns Name begin set first name = f; set middle initial = m; set last name = l; end create function Street (sname varchar(15), sno varchar(4), ano varchar(7))

4 Chapter 22 Object-Based Databases returns Street begin set street name = sname; set street number = sno; set apartment number =ano; end create function Address (s Street, c varchar(15), sta varchar(15), zip varchar(6)) returns Address begin set street = s; set city = c; set state =sta; set zip code =zip; end 22.4 Consider the relational schema shown in Figure 22.6. a. Give a schema definition in SQLcorresponding to the relational schema, but using references to express foreign-key relationships. b. Write each of the queries given in Exercise 6.13 on the above schema, using SQL. a. The schema definition is given below. Note that backward references can be addedbut they are not so important as in OODBS because queries can be written in SQL and joins can take care of integrity constraints. create type Employee (person name varchar(30), street varchar(15), city varchar(15)) create type Company (company name varchar(15), (city varchar(15)) create table employee of Employee create table company of Company create type Works (person ref(employee) scope employee, comp ref(company) scope company, salary int) create table works of Works create type Manages (person ref(employee) scope employee, (manager ref(employee) scope employee) create table manages of Manages b. i. select comp >name

Practice Exercises 5 ii. iii. group by comp having count(person) all(select count(person) group by comp) select comp >name group by comp having sum(salary) all(select sum(salary) group by comp) select comp >name group by comp having avg(salary) > (select avg(salary) where comp >company name="first Bank Corporation") 22.5 Suppose that you have been hired as a consultant to choose a database system for your client s application. For each of the following applications, state what type of database system (relational, persistent programming language based OODB, object relational; do not specify a commercial product) you would recommend. Justify your recommendation. a. A computer-aided design system for a manufacturer of airplanes. b. A system to track contributions made to candidates for public office. c. An information system to support the making of movies. a. A computer-aided design system for a manufacturer of airplanes: An OODB system would be suitable for this. That is because CAD requires complex data types, and being computation oriented, CAD tools are typically used in a programming language environment needing to access the database. b. A system to track contributions made to candidates for public office: A relational system would be apt for this, as data types are expected to be simple, and a powerful querying mechanism is essential. c. An information system to support the making of movies: Here there will be extensive use of multimedia and other complex data types. But queries are probably simple, and thus an object relational system is suitable.

6 Chapter 22 Object-Based Databases 22.6 How does the concept of an object in the object-oriented model differ from the concept of an entity in the entity-relationship model? An entity is simply a collection of variables or data items. An object is an encapsulation of data as well as the methods (code) to operate on the data. The data members of an object are directly visible only to its methods. The outside world can gain access to the object s data only by passing pre-defined messages to it, and these messages are implemented by the methods.