The description starts with »inherited columns«.
Let us check the definition of the inheritance in OOP. For example, in MSDN, Visual basic Language Concepts, you can read this definition: »Derived classes inherit, and can extend, the properties, methods, and events of the base class«. Or, In C# Programming Guide, you can read: »The new class—the derived class—then gains all the non-private data and behavior of the base class in addition to any other data or behaviors it defines for itself«.
Inheritance means gaining knowledge, i.e. operations of the base class, not private data (data of an object should be private anyway in a good OOP). Now, what kind of operations do we have defined on views? And do views hide any data, do they have any private members? Let us check how this »inheritance« is implemented physically. With
EXEC sp_helptext ‘sys.objects’;
EXEC sp_helptext ‘sys.tables’;
You get the following definitions:
CREATE VIEW sys.objects AS
SELECT name, object_id, principal_id, schema_id, parent_object_id,
type, type_desc, create_date, modify_date,
is_ms_shipped, is_published, is_schema_published
CREATE VIEW sys.tables AS
SELECT o.name, o.object_id, o.principal_id, o.schema_id, o.parent_object_id,
o.type, o.type_desc, o.create_date, o.modify_date,
o.is_ms_shipped, o.is_published, o.is_schema_published,
lob.lobds AS lob_data_space_id,
rfs.indepid AS filestream_data_space_id,
o.property AS max_column_id_used,
o.lock_on_bulk_load, o.uses_ansi_nulls, o.is_replicated, o.has_replication_filter,
o.is_merge_published, o.is_sync_tran_subscribed, o.has_unchecked_assembly_data,
lob.intprop AS text_in_row_limit,
FROM sys.objects$ o
LEFT JOIN sys.sysidxstats lob ON lob.id = o.object_id AND lob.indid <= 1
LEFT JOIN sys.syssingleobjrefs rfs ON rfs.depid = o.object_id AND rfs.class = 42 AND rfs.depsubid = 0 — SRC_OBJTOFSDS
WHERE o.type = ‘U’
Therefore, »inheritance« is implemented as copy and paste of column names from the columns list (SELECT part)! This is a new definition of the »inheritance« for me. I would appreciate if the author would write more about this type of »inheritance«; it seems like thousands of developers worldwide have to re-learn OOP basics.
Well, this was, of course, sarcasm. This is just another example of incorrect usage of terminology. Unifying object and relational world is a big fad nowadays. It seems like anybody who has five minutes time wants to catch that train, and uses object terminology for relational databases without having basic knowledge and understanding of either, relational model and object-oriented programming.
Besides projects, I spend about half of the time on training and mentoring. I am the founder of the Slovenian SQL Server and .NET Users Group. and the main author or coauthor of eleven books about databases and SQL Server. I also developed many courses and seminars for SolidQ.
Latest posts by Dejan Sarka (see all)
- Python for SQL Server Specialists Part 4: Python and SQL Server - April 24, 2018
- Python for SQL Server Specialists Part 3: Graphs and Machine Learning - April 11, 2018
- Python for SQL Server Specialists Part 2: Working with Data - March 22, 2018