Database Systems - Object Types - Object Oriented Programming OOP - Object Relational Mapping ORM

preview_player
Показать описание
Object-orientated programming

Object-oriented programming languages like Java, Python, and C++ are very popular. They model objects after real-world object, and each object has data and methods. A class is a blueprint for creating objects. If you had a class called Car, it defines the data and actions that a car can do. One Car class can create many Car objects. A Car object has data (defined by the class) for the make, model, year, and color, and methods which are functions that the object can do like accelerate, turn right, honk horn, etc. Object-oriented programming has capabilities such as:

Composite types – combining several properties into one object type
Methods – functions that the object can do
Subtypes – Using inheritance to create subclasses from your class. For example, A sports car is a subclass (derived class) of the car class. Car is also called the superclass (base class)
Overriding – replacing the functionality of a superclass method with your own code

Object-relational databases

An object database is a database management system in which information is represented in the form of objects as used in object-oriented programming. Some popular databases such as Oracle, PostgreSQL, SQL Server, Informix and DB2 provide support for objects, but unfortunately MySQL does not. Oracle Database is the most popular object-relational database.

object-relational mapping (ORM) - a software layer between the relational database and the OOP programming language which converts object structures and queries to relational structures and queries. An object-relational database extends SQL with object types. Some databases call subtypes ‘subtables’, and call supertypes ‘supertables’.

Object types and Subtypes

The following statements work on Oracle, but not MySQL

CREATE TYPE AS OBJECT specifies a type name and associated properties, functions, and procedures.
CREATE TYPE BODY AS specifies the code, or body, of each function and procedure associated with the object type.
CREATE TABLE OF  creates a table from an object type. 
CREATE TYPE UNDER creates subtypes
OVERRIDE keyword allows a subtype override inherited functions and procedures

Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!
Рекомендации по теме
join shbcf.ru