2023-03-11 15:31:31 +00:00
|
|
|
-- Tags: no-parallel
|
|
|
|
|
2023-02-19 20:14:22 +00:00
|
|
|
SET allow_experimental_analyzer = 1;
|
|
|
|
|
2019-04-22 11:48:37 +00:00
|
|
|
DROP TABLE IF EXISTS one;
|
|
|
|
CREATE TABLE one(dummy UInt8) ENGINE = Memory;
|
2018-09-24 13:55:26 +00:00
|
|
|
|
2018-10-31 15:09:53 +00:00
|
|
|
SELECT database, t.name
|
|
|
|
FROM system.tables AS t
|
|
|
|
ALL INNER JOIN (SELECT name AS database FROM system.databases) AS db USING database
|
|
|
|
WHERE database = 'system' AND t.name = 'one'
|
|
|
|
FORMAT PrettyCompactNoEscapes;
|
|
|
|
|
|
|
|
SELECT database, t.name
|
|
|
|
FROM (SELECT name AS database FROM system.databases) AS db
|
|
|
|
ALL INNER JOIN system.tables AS t USING database
|
|
|
|
WHERE database = 'system' AND t.name = 'one'
|
|
|
|
FORMAT PrettyCompactNoEscapes;
|
|
|
|
|
|
|
|
SELECT database, t.name
|
|
|
|
FROM (SELECT name, database FROM system.tables) AS t
|
|
|
|
ALL INNER JOIN (SELECT name AS database FROM system.databases) AS db USING database
|
|
|
|
WHERE database = 'system' AND t.name = 'one'
|
|
|
|
FORMAT PrettyCompactNoEscapes;
|
|
|
|
|
2018-09-24 13:55:26 +00:00
|
|
|
SELECT x, t.name
|
|
|
|
FROM (SELECT name, database AS x FROM system.tables) AS t
|
|
|
|
ALL INNER JOIN (SELECT name AS x FROM system.databases) AS db USING x
|
|
|
|
WHERE x = 'system' AND t.name = 'one'
|
|
|
|
FORMAT PrettyCompactNoEscapes;
|
|
|
|
|
2018-10-31 15:09:53 +00:00
|
|
|
SELECT database, t.name
|
|
|
|
FROM (SELECT name, database FROM system.tables) AS t
|
|
|
|
JOIN (SELECT name AS database FROM system.databases) AS db USING database
|
|
|
|
WHERE database = 'system' AND t.name = 'one'
|
|
|
|
SETTINGS join_default_strictness = 'ALL'
|
|
|
|
FORMAT PrettyCompactNoEscapes;
|
|
|
|
|
2018-09-24 13:55:26 +00:00
|
|
|
SELECT x, t.name
|
|
|
|
FROM (SELECT name, database AS x FROM system.tables) AS t
|
|
|
|
JOIN (SELECT name AS x FROM system.databases) AS db USING x
|
|
|
|
WHERE x = 'system' AND t.name = 'one'
|
|
|
|
SETTINGS join_default_strictness = 'ALL'
|
|
|
|
FORMAT PrettyCompactNoEscapes;
|
|
|
|
|
|
|
|
SET join_default_strictness = 'ALL';
|
|
|
|
|
|
|
|
SELECT database, t.name
|
|
|
|
FROM (SELECT * FROM system.tables) AS t
|
|
|
|
JOIN (SELECT name, name AS database FROM system.databases) AS db USING database
|
|
|
|
WHERE db.name = 'system' AND t.name = 'one'
|
|
|
|
FORMAT PrettyCompactNoEscapes;
|
|
|
|
|
2019-04-18 14:45:23 +00:00
|
|
|
SELECT db.x, t.name
|
|
|
|
FROM (SELECT name, database AS x FROM system.tables) AS t
|
|
|
|
JOIN (SELECT name AS x FROM system.databases) AS db USING x
|
|
|
|
WHERE x = 'system' AND t.name = 'one'
|
|
|
|
FORMAT PrettyCompactNoEscapes;
|
2018-09-24 13:55:26 +00:00
|
|
|
|
2019-04-18 14:45:23 +00:00
|
|
|
SELECT db.name, t.name
|
2018-09-24 13:55:26 +00:00
|
|
|
FROM (SELECT name, database FROM system.tables WHERE name = 'one') AS t
|
2019-04-18 14:45:23 +00:00
|
|
|
JOIN (SELECT name FROM system.databases WHERE name = 'system') AS db ON t.database = db.name
|
|
|
|
FORMAT PrettyCompactNoEscapes;
|
2018-09-24 13:55:26 +00:00
|
|
|
|
2019-01-31 18:10:16 +00:00
|
|
|
SELECT db.name, t.name
|
|
|
|
FROM system.tables AS t
|
|
|
|
JOIN (SELECT * FROM system.databases WHERE name = 'system') AS db ON t.database = db.name
|
2019-04-18 14:45:23 +00:00
|
|
|
WHERE t.name = 'one'
|
|
|
|
FORMAT PrettyCompactNoEscapes;
|
2018-09-24 13:55:26 +00:00
|
|
|
|
2019-04-18 14:45:23 +00:00
|
|
|
SELECT t.database, t.name
|
2018-09-24 13:55:26 +00:00
|
|
|
FROM system.tables AS t
|
|
|
|
JOIN (SELECT name, name AS database FROM system.databases) AS db ON t.database = db.name
|
2019-04-18 14:45:23 +00:00
|
|
|
WHERE t.database = 'system' AND t.name = 'one'
|
|
|
|
FORMAT PrettyCompactNoEscapes;
|
|
|
|
|
|
|
|
SELECT t.database, t.name
|
|
|
|
FROM system.tables t
|
|
|
|
ANY LEFT JOIN (SELECT 'system' AS base, 'one' AS name) db USING name
|
|
|
|
WHERE t.database = db.base
|
|
|
|
FORMAT PrettyCompactNoEscapes;
|
2018-09-24 13:55:26 +00:00
|
|
|
|
|
|
|
SELECT count(t.database)
|
|
|
|
FROM (SELECT * FROM system.tables WHERE name = 'one') AS t
|
|
|
|
JOIN system.databases AS db ON t.database = db.name;
|
|
|
|
|
2019-01-31 18:10:16 +00:00
|
|
|
SELECT count(db.name)
|
|
|
|
FROM system.tables AS t
|
|
|
|
JOIN system.databases AS db ON t.database = db.name
|
|
|
|
WHERE t.name = 'one';
|
2018-09-24 13:55:26 +00:00
|
|
|
|
|
|
|
SELECT count()
|
|
|
|
FROM system.tables AS t
|
|
|
|
JOIN system.databases AS db ON db.name = t.database
|
|
|
|
WHERE t.name = 'one';
|
|
|
|
|
2019-04-22 11:48:37 +00:00
|
|
|
DROP TABLE one;
|