简体   繁体   English

将数据插入关系数据库的最简单方法是什么?

[英]What is the easiest way to insert data into a relational database?

I have a relational database set up and I want to be able to insert data in an intuitive manner despite the normalization.我设置了一个关系数据库,尽管进行了规范化,但我希望能够以直观的方式插入数据。 For instance, I have a table for "ideals" and another table for "actions that this ideal promotes."例如,我有一个“理想”表和另一个“这个理想促进的行动”表。 However, I want to insert this data like a backwards view.但是,我想像向后视图一样插入这些数据。 I want to be able to list an "ideal" and then just list as many actions as I want in the same window.我希望能够列出一个“理想”,然后在同一个 window 中列出我想要的尽可能多的操作。 There has to be some best practice for this kind of thing.这种事情必须有一些最佳实践。 How should I got about this?我该怎么办?

EDIT: data will only be editing my me.编辑:数据只会编辑我的我。 It will never be edited by users.它永远不会被用户编辑。 So I want to know how to edit this data in sqlite DBBrowser, not in a UI.所以我想知道如何在 sqlite DBBrowser 中编辑这些数据,而不是在 UI 中。

It sounds like you want to insert your data into views and not tables .听起来您想将数据插入视图而不是

Many databases support triggers on views.许多数据库支持视图触发器。 So, you define the "intuitive" views that you want.因此,您可以定义所需的“直观”视图。 Then you write the triggers that do the appropriate manipulations to the underlying tables.然后编写对基础表进行适当操作的触发器。

If your data is starting out in a file, then you can use an alternative approach.如果您的数据是从文件开始的,那么您可以使用另一种方法。 You would load the file into a staging table and then use a stored procedure to convert the staging table into the appropriate underlying tables.您可以将文件加载到临时表中,然后使用存储过程将临时表转换为适当的基础表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM