gpt4 book ai didi

sql - 如何列出SQL Anywhere中的所有用户表及其行数?

转载 作者:行者123 更新时间:2023-12-04 03:44:11 26 4
gpt4 key购买 nike

我想列出数据库中所有可用的表,并能够按行数进行排序和过滤。

最佳答案

这很容易:

select table_name, count
from systable
where primary_root<>0 and creator=1
order by 1

或如何添加列数和名称?
select t.table_name, t.count rows, count(*) cols,
list(c.column_name order by c.column_id) col_list
from systable t
left outer join syscolumn c on c.table_id=t.table_id
where t.primary_root<>0 and t.creator=1
group by t.table_name, t.count
order by 1

希望这可以帮助...

更多信息:从SQL Anywhere 10开始,systable和syscolumn成为唯一的向后兼容 View ,而Sybase建议改用较新的系统表...因为我使用的是版本9和11,所以我坚持使用这些表。

关于sql - 如何列出SQL Anywhere中的所有用户表及其行数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19660814/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com