我可以存储“别名”吗?我使用 SQLite 时的信息?
我有一个脚本可以解析 xml 文件以自动生成 SQLite 表。并且,简化的命令如下。
Table string CREATE TABLE IF NOT EXISTS benchmark (id integer primary key autoincrement,Version float, CompilationParameters_Family text, CompilationParameters_XilinxVersion text, CompilationParameters_Device text, CompilationParameters_XilinxParameterList_Parameter_OptimizationGoal text, CompilationParameters_XilinxParameterList_Parameter_PlacerEffortLevel text)
它工作得很好,但我想知道是否可以为数据库中的长名称附加一些别名。
这可能吗?我的意思是,我可以有一个类似的命令
Table string ... CompilationParameters_XilinxVersion tex >>as version<< ...
,以便在检索数据时可以使用 CompilationParameters_XilinxVersion 或 version 吗?
I have a script that parses xml file to generate SQLite table automatically. And, the simplified command is as follows.
Table string CREATE TABLE IF NOT EXISTS benchmark (id integer primary key autoincrement,Version float, CompilationParameters_Family text, CompilationParameters_XilinxVersion text, CompilationParameters_Device text, CompilationParameters_XilinxParameterList_Parameter_OptimizationGoal text, CompilationParameters_XilinxParameterList_Parameter_PlacerEffortLevel text)
It works well, but I wonder if I can attach some aliases for the long name in a database.
Is this possible? I mean, can I have a command something like
Table string ... CompilationParameters_XilinxVersion tex >>as version<< ...
so that I can use CompilationParameters_XilinxVersion or version when retrieve the data.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你想要做的事情在 SQL 中是不可能的。但是,您可能希望创建一个
VIEW
来简单地替换长列名和短列别名。请注意,sqlite 中的VIEW
是只读的,因此不能被写信给.What you're trying to do is not possible in SQL. However, you may want to create a
VIEW
that simply substitutes the long column names with your short column aliases. Note thatVIEW
s in sqlite are read-only and therefore cannot be written to.