我对MS Sql Server有以下查询,
SELECT DISTINCT
OnTable.name as OnTable,
AgainstTable.name as AgainstTable
FROM sysforeignkeys fk
INNER JOIN sysobjects onTable ON fk.fkeyid = onTable.id
INNER JOIN sysobjects againstTable ON fk.rkeyid = againstTable.id
现在,我需要在MariaDB中创建一个等效查询。基本上,我需要知道MariaDB中的哪些表可以替换sysforeignkeys和sysobjects?
答案 0 :(得分:1)
您在这里:
my_data2 <- my_data %>%
group_by(group) %>%
nest() %>%
mutate(km_cluster = map(data, ~kmeans(.x, 3))) %>%
mutate(data = map2(data, km_cluster, ~.x %>% mutate(cluster = .y[["cluster"]])),
data = map2(data, km_cluster, ~left_join(.x,
.y %>%
pluck("centers") %>%
as_data_frame() %>%
rowid_to_column() %>%
rename(x_center = x, y_center = y),
by = c("cluster" = "rowid"))))
好吧,您的查询显示的细节较少。这是等效的内容:
select
fk.constraint_name,
c.ordinal_position,
c.table_schema,
c.table_name,
c.column_name,
c.referenced_table_schema,
c.referenced_table_name,
c.referenced_column_name
from information_schema.table_constraints fk
join information_schema.key_column_usage c
on c.constraint_name = fk.constraint_name
where fk.constraint_type = 'FOREIGN KEY';