Is there a database table namespace?

I was always interested in one relevant (for me), but not existing function of all the relational databases that I worked with: the impossibility of namespace tables.

in MySQL, for example, you can fully qualify a table with a database name, for example dbname.tablename, with a database acting as a "prefix" or "namespace". However, this function stops here, and you are not very far from it. Namespace support will provide you with the ability to have type syntax dbname.namespace.table. You can group related tables into different namespaces, for example (for a blog)

db.userdata.logininfo
db.userdata.preferences
db.postdata.content
db.postdata.acls

or

db.blog.whatever
db.wiki.whatever
db.common.auth

This would allow us to remain in the same database (using all the advantages of such a setting) and at the same time provide a more flexible and self-documenting environment. However, most of the time I found that underlining the table name is used for this purpose as an obvious workaround.

My questions are: are there DBMSs with such a function (possibly with a different name)? Is this considered not important enough in database design practice to get support?

+5
source share
3 answers

I believe this is called a schema in SQL Server . It was introduced in SQL Server 2005. Tables refer to schemas and are referenced through dotted notation, for example owner.schema.tablename, for example dbo.HumanResources.Employee.

AdventureWorks, SQL Server.

, , , SQL Server, . , :

SQL Server 2005

SQL Server 2005:

+3

MS SQL Server (2005+) , (. AdventureWorks).

Oracle , , .

(MS [], Oracle "") namespace.name.

0

I have never seen a hierarchical namespace in database tables, but you can use schemas in SQL Server 2005+ for this. Similar designs exist on other DBMS platforms.

Oracle has a module area for stored procedure code (called packages) that gives you module level namespaces for code. Nothing equivalent exists in T-SQL, although stored procedures can live in schemas.

0
source

All Articles