【问题标题】:rdbms "view" equivalent on orientdborientdb 上的 rdbms“视图”等效项
【发布时间】:2016-06-27 21:17:51
【问题描述】:

在 orientdb 上是否有等效的“视图”?

我有 rdbms 背景,正在寻找一种方法将查询保存为我可以直接查询的对象。

以下面的查询为例 SELECT mobile_number AS mobile_number, verifications.verification_code[0] AS verification_code, verifications.is_verified[0] AS is_verified, Max(verifications.active_devices .@ rid) AS device_rid, verifications.active_devices .@ version AS active_version FROM guests

我想用这个名为verified_guests 的查询创建一个“视图”,然后我想使用select from verified_guests 之类的东西对verified_guests 执行一个查询

在 rdbms 世界中,我可以做到以下几点 create view verified_guests as SELECT mobile_number AS mobile_number, verifications.verification_code[0] AS verification_code, verifications.is_verified[0] AS is_verified, Max(verifications.active_devices .@ rid) AS device_rid, verifications.active_devices .@ version AS active_version FROM guests

那么我就可以select * from verified_guests

orientdb 有与之等效或替代的吗?

感谢任何指导。

谢谢,

【问题讨论】:

    标签: orientdb orientdb-2.1


    【解决方案1】:

    我制作了这个架构来重现您的问题:

    create class guests extends V
    create property guests.mobile_number integer
    create property guests.name string
    

    试试这个:

    create class verified_guests extends V
    INSERT INTO verified_guests FROM SELECT mobile_number, name FROM guests
    

    这是结果:

    select * from verified_guests
    

    希望对你有帮助。

    问候。

    【讨论】:

    • 在 RDBMS 中,视图只是一个查询。如果您在任何基础表中添加/删除/更新记录,并且视图会自动反映这些更改。在这个例子中没有发生这种情况。我在 OrientDB 中尝试过这个,verified_guests 不会自动添加客人。您所展示的完全不像 SQL 数据库中的视图。还是我错过了什么?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-05
    • 2018-11-26
    相关资源
    最近更新 更多