SQLize
Online
/
PHPize Online
/
SQLtest Online
A
A
A
Share
Donate
Blog
Popular
Donate
A
A
A
Share
Blog
Popular
SQLize.online is a free online SQL environment for quickly running, experimenting with and sharing code.
You can run your SQL code on top of the most popular RDBMS including MySQL, MariaDB, SQLite, PostgreSQL, Oracle and Microsoft SQL Server.
SQL code:
Upload
Copy
Format
Clear
CREATE TABLE IF NOT EXISTS my_table ( ID INT, UF_EN VARCHAR(255), UF_RU VARCHAR(255), UF_NAME VARCHAR(255), UF_GROUP VARCHAR(255), UF_SORT VARCHAR(255), UF_BOLD VARCHAR(255), UF_GENERAL VARCHAR(255) ); INSERT INTO `my_table` (`ID`, `UF_EN`, `UF_RU`, `UF_NAME`, `UF_GROUP`, `UF_SORT`, `UF_BOLD`, `UF_GENERAL`) VALUES (12, 'Other Than Fixed Noncurrent Assets', 'Кроме основных внеоборотных активов', 'OtherThanFixedNoncurrentAssets', 'balance_sheet', 2, 0, 0); INSERT INTO `my_table` (`ID`, `UF_EN`, `UF_RU`, `UF_NAME`, `UF_GROUP`, `UF_SORT`, `UF_BOLD`, `UF_GENERAL`) VALUES (13, 'Participating Securities, Distributed And Undistributed Earnings/Loss, Basic', 'Дивиденды по привилегированным акциям и др. корректировки', 'ParticipatingSecuritiesDistributedAndUndistributedEarningsLossBasic', 'income_statement', 13, 0, 0); INSERT INTO `my_table` (`ID`, `UF_EN`, `UF_RU`, `UF_NAME`, `UF_GROUP`, `UF_SORT`, `UF_BOLD`, `UF_GENERAL`) VALUES (14, 'Redeemable Noncontrolling Interest', 'Подлежащая погашению неконтролирующая доля', 'RedeemableNoncontrollingInterest', 'balance_sheet', 12, 0, 0); INSERT INTO `my_table` (`ID`, `UF_EN`, `UF_RU`, `UF_NAME`, `UF_GROUP`, `UF_SORT`, `UF_BOLD`, `UF_GENERAL`) VALUES (15, 'Equity Attributable To Noncontrolling Interest', 'Собственный капитал, относящийся к неконтролирующей доле', 'EquityAttributableToNoncontrollingInterest', 'balance_sheet', 7, 0, 0); INSERT INTO `my_table` (`ID`, `UF_EN`, `UF_RU`, `UF_NAME`, `UF_GROUP`, `UF_SORT`, `UF_BOLD`, `UF_GENERAL`) VALUES (16, 'Assets', 'Активы', 'Assets', 'balance_sheet', 5, 1, 1); INSERT INTO `my_table` (`ID`, `UF_EN`, `UF_RU`, `UF_NAME`, `UF_GROUP`, `UF_SORT`, `UF_BOLD`, `UF_GENERAL`) VALUES (17, 'Noncurrent Assets', 'Внеоборотные активы', 'NoncurrentAssets', 'balance_sheet', 3, 1, 0); DROP FUNCTION IF EXISTS dynam_parse; DELIMITER // CREATE FUNCTION dynam_parse(dynam JSON) RETURNS JSON COMMENT 'Парсит поле dynam и отдаёт JSON с параметрами: [param_code:{title, value}]' LANGUAGE SQL NOT DETERMINISTIC BEGIN DECLARE i INT DEFAULT 0; DECLARE param VARCHAR(255); DECLARE param_data JSON DEFAULT '{"code":null,"name":null,"sort":null,"value":null}'; DECLARE params JSON DEFAULT '{}'; DECLARE dynam_keys JSON default JSON_KEYS(dynam); SET param_data = '{}'; WHILE i < JSON_LENGTH(dynam_keys) DO SET param = JSON_EXTRACT(dynam_keys, CONCAT('$[', i , ']')); SET param_data = (SELECT JSON_OBJECT('value', JSON_EXTRACT(dynam, CONCAT('$.', param)),'code', UF_NAME, 'name', UF_RU, 'sort', UF_SORT, 'is_bold', UF_BOLD) FROM my_table WHERE UF_EN = param); SET params = JSON_INSERT(params, CONCAT('$.', param ), param_data); SET i = i + 1; END WHILE; RETURN params; END // DELIMITER ; SELECT dynam_parse('{"Assets": "123", "test1": "456"}') as result;
SQL
Server:
MariaDB 11.4
MariaDB 11.5
MariaDB 10
MariaDB 10 Sakila (ReadOnly)
MySQL 5.7
MySQL 5.7 Sakila (ReadOnly)
MySQL 8.0
MySQL 8.0 Sakila (ReadOnly)
SQLite 3
PostgreSQL 10 Bookings (ReadOnly)
PostgreSQL 11
PostgreSQL 12
PostgreSQL 13
PostgreSQL 14
PostgreSQL 15
MS SQL Server 2017
MS SQL Server 2019
MS SQL Server 2022
MS SQL Server 2022 AdventureWorks (ReadOnly)
Firebird 4.0
Firebird 4.0 (Employee)
Oracle Database 19c (HR)
Oracle Database 21c
Oracle Database 23c Free
SOQOL
Version
ER Diagram
Preserve result
Stuck with a problem?
Got Error?
Ask ChatGPT!
Result:
Copy
Clear