A Simpler (And Better) SQL Approach To Relational Division
A Simpler (And Better) SQL Approach To Relational Division
13(2)
Teaching Tip
Victor M. Matos
Computer and Information Science Department
Cleveland State University
Cleveland, Ohio 44114
[email protected]
Rebecca Grasser
Information Systems Department
Lakeland Community College
Kirtland, Ohio 44094
[email protected]
ABSTRACT
A common type of database query requires one to find all tuples of some table that are related to each and every one of
the tuples of a second group. In general those queries can be solved using the relational algebra division operator.
Relational division is very common and appears frequently in many queries. However, we have found that the phrasing
of this operator in SQL seems to present an overwhelming challenge to novice and experienced database programmers.
Furthermore, students seem to have the most problems with the SQL version commonly recommended in the database
literature. We present an alternative solution that is not only more intuitive and easier to deliver in the classroom but
also exhibits a better computational performance.
Keywords: Database systems, SQL, Division operator, Relational algebra, Classroom presentation, Human reactions,
Code performance.
85
Journal of Information Systems Education, Vol. 13(2)
86
Journal of Information Systems Education, Vol. 13(2)
87
Journal of Information Systems Education, Vol. 13(2)
ISBN 0-471-18074-2.
AUTHOR BIOGRAPHIES
Victor Matos is an Associate
Professor of Computer and
Information Science at Cleveland
State University in Cleveland,
Ohio.
Rebecca Grasser is an
Assistant Professor of Information
Systems at Lakeland Community
College in Kirtland, Ohio.
88
Information Systems & Computing
Academic Professionals
Copyright ©2002 by the Information Systems & Computing Academic Professionals, Inc. (ISCAP). Permission to make digital
or hard copies of all or part of this journal for personal or classroom use is granted without fee provided that copies are not made
or distributed for profit or commercial use. All copies must bear this notice and full citation. Permission from the Editor is
required to post to servers, redistribute to lists, or utilize in a for-profit or commercial use. Permission requests should be sent to
the Editor-in-Chief, Journal of Information Systems Education, [email protected].
ISSN 1055-3096