首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >检查Tarantool中是否存在SQL表

检查Tarantool中是否存在SQL表
EN

Stack Overflow用户
提问于 2019-07-16 23:01:13
回答 1查看 131关注 0票数 4

如果表已经存在,我如何检入Tarantool SQL?

EN

回答 1

Stack Overflow用户

发布于 2019-07-16 23:04:43

只使用SQL工具就可以这样做:

代码语言:javascript
复制
SELECT EXISTS (select true from "_space" where "name" = 'table_name')

例如:

代码语言:javascript
复制
tarantool> SELECT EXISTS (select true from "_space" where "name" = 'T1')
---
- metadata:
  - name: EXISTS (select true from "_space" where "name" = 'T1')
    type: boolean
  rows:
  - [true]
...

tarantool> SELECT EXISTS (select true from "_space" where "name" = 'T')
---
- metadata:
  - name: EXISTS (select true from "_space" where "name" = 'T')
    type: boolean
  rows:
  - [false]
...

在Lua模式下:

代码语言:javascript
复制
tarantool> box.space.T1 ~= nil
---
- true
...

tarantool> box.space.T ~= nil
---
- false
...
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57060252

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档