Is the SQL language object oriented?

Asked

Viewed 1,780 times

22

Is the SQL language object oriented? If so, could you show an example?

  • 6

    No, sql is language for relational database manipulation. A better definition : SQL is a standardized language for defining and manipulating relational databases. Typically, an DBMS offers an SQL interpreter that allows you to isolate the application from data storage details. ... a data manipulation language (DML) for reading and writing data. by google

3 answers

22

SQL means Structured Query Language, that is, it is a structured language, specific for handling in relational databases (whether SQL Server, Mysql, etc).

Therefore, there is no support for object orientation in it.

There is also the Nosql, that some call Not Only Structured Query Language and others of Non Structured Query Language, using other data models, such as Documents and Charts.

Nosql databases use a variety of data models, including documents, charts, value-key and columnists.

Source: Amazon Nosql.

Still, I do not consider it a language that offers orientation to objects, because for this, it would need to have support to inheritance, encapsulation and polymorphism, which are concepts of Object Orientation.

19

She’s not even a programming language. So it would not be appropriate to analyze whether it has mechanisms of object-oriented programming languages. It does not support paradigms typical programming languages. It does not have all the capabilities of a Turing machine.

Although the name includes the structured word, it also has nothing to do with the paradigm of structured programming.

She doesn’t own any of the pillars of object orientation which are heritage, encapsulation and polymorphism. It does not possess objects said property, so it can’t be oriented towards them. Guidance requires much more than a basic programming language offers and SQL does not even offer the basics.

SQL, as the name says, is a query language, it is purely declarative and nonimperative. So it’s possible to just state intentions. Of course, in addition to queries we can update and model how we want the database, but we can’t do structured operations, we can’t command everything as we want doing complete algorithms, much less we can structure objects as defined in OOP.

Some SQL-based languages such as SQL T-SQL Server or Oracle PL/SQL and others are considered programming languages, even though they do not have object-oriented mechanisms. Unlike C that has some mechanisms that allow to make an OO code almost illegible, these languages have nothing to aid this and it becomes practically impossible to adopt the paradigm. Maybe in some crazy way, but it would have huge harm.

One may question whether it is possible to adopt an object-oriented model in SQL. The answer would be no, but it is possible to adopt an object-oriented model in the database tables, which is different from SQL. Even though the database does not offer many features is still possible in some way, not fully, perhaps not in all databases. Some Dbs offer facilities that gives to model the tables as objects, but not SQL.

This makes perfect sense because OO has to do with organizing the data structure more than programming itself.

Additionally, Nosql is an access model, not even a language, so no comparisons.

Object orientation is overrated. Today it’s fashionable for everyone to want to do OO even if they don’t even know if it will have benefits with it. It’s actually common for people to say they’re doing it and they’re not doing it, just to be fashionable. A "methodology" should be adopted for some benefit, and only after mastering it, which in the case of OO is not easy.

Complement: POO is the same in all languages?

2

Only complementing that PL/SQL already has Object Orientation implementation, and very well, thank you. Before, with the Packages, one can simulate, to a certain extent, a "Class", now one can actually create a Class, with its methods, properties, and everything that is entitled, and with that, an object of it, to manipulate within other Classes and/or other Packages and/or Procedures and/or Functions. This is the great cheap today of PL/SQL, because we can have business layer objects, whose methods can execute code in Classes object methods defined in PL/SQL same. With this the code in PL/SQL became much cleaner and simple to understand later.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.