90 likes | 165 Views
Explore the essential rules for designing and implementing a Relational Database while integrating it with Object-Oriented code. Learn about associations, classes, objects, relationships, and keys in this comprehensive guide.
E N D
I4DAB1 Autumn 2007 Introduction Some simple rules.
Sow what… • Databases (DB) is an old technology when looking at IT’s. • As with all other information technologies, using DB together with another technologies gives some “constraints” • DAB1 looks at how to design and implements a Relational Database • And to use a database together with some OO-code
Constraints ..Wich? • Using an already implemented database is relative simple • Designing it may be cumbersome • You already know that from doing your OO modeling. • How do you implement an association? • How do you setting up a model?
“Rule 1” • Associations in Object Orientation: • Inheritance (Generalization/Specialization) • Composition • Aggregation • Others..? No • becomes all to Relationships in DB orientation! When using a Relational DB
“Rule 2” • What about classes and objects? • An OO class becomes one or more relations • An OO object becomes one or more Tuples /records in one or more relations. • OO attributes becomes DB attributes. • And the methods do not exist! (well.. At least for a little time)
“Rule 3” • One more rule is needed.. • Relations (Classes?) are implemented in tables • Tuples/Records are rows in the table • Attributes are columns in the table
“Rule 4” • One more rule too, is “needed” • What we consider references in OO and relationships in RDB are implemented as Keys in the Relational Database Managaement system. Primary or Foreign Key
“Rule 5” • And yet another rule • “Talking” to a Relational Database Management System (RDBMS) is done in Structured Query Language (SQL) Data Definition Language (DDL) Data Manipulation Language (DML) • RDBMS “talks” to any systems that talks SQL DDL and DML.