Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
-- Эксперимент без CTE. CREATE TABLE x AS SELECT * FROM generate_series(0, 99) AS t(i); SELECT * FROM x WHERE i = floor(random() * 100); -- OK. Генерируются случайные целые числа из диапазона [0;99] SELECT (SELECT floor(random() * 100 + 0 * j)::integer) FROM generate_series(0,100) AS t(j); -- FAIL. Куча NULLs. SELECT (SELECT * FROM x WHERE i = floor(random() * 100 + 0 * j)::integer LIMIT 1) AS ss FROM generate_series(0,100) AS t(j);

Stuck with a problem? Got Error? Ask AI support!

Copy Clear