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 `pbxu_autocallcampaings_shedule` ( `id` int(11) NOT NULL AUTO_INCREMENT, `autocallcampaing_id` int(11) NOT NULL DEFAULT '0', `insert_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `in_work` int(1) NOT NULL DEFAULT '0', `attempt_cnt` int(3) NOT NULL DEFAULT '0', `phone_numbers` varchar(400) NOT NULL DEFAULT '', `task_id` varchar(200) NOT NULL DEFAULT '', `task_name` varchar(400) NOT NULL DEFAULT '', `res` int(1) NOT NULL DEFAULT '0', `res_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `bill_sec` int(11) NOT NULL DEFAULT '0', `answer_cnt` int(11) NOT NULL DEFAULT '0', `listen_cnt` int(11) NOT NULL DEFAULT '0', `noanswer_cnt` int(11) NOT NULL DEFAULT '0', `busy_cnt` int(11) NOT NULL DEFAULT '0', `failed_cnt` int(11) NOT NULL DEFAULT '0', `run` int(1) NOT NULL DEFAULT '1', `stoplist_cnt` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `in_work` (`in_work`), KEY `res` (`res`), KEY `attempt_cnt` (`attempt_cnt`), KEY `res_date` (`res_date`), KEY `autocallcompany_id` (`autocallcampaing_id`), KEY `run` (`run`), KEY `phone_numbers` (`phone_numbers`(255)), KEY `task_id` (`task_id`) ) ENGINE=InnoDB AUTO_INCREMENT=24827083 DEFAULT CHARSET=utf8; CREATE TEMPORARY TABLE numbers ( id INT NOT NULL AUTO_INCREMENT, number VARCHAR(10) NOT NULL, PRIMARY KEY (id) ); INSERT INTO pbxu_autocallcampaings_shedule (id, autocallcampaing_id, insert_date, in_work, attempt_cnt, phone_numbers, task_id, task_name, res, res_date, bill_sec, answer_cnt, listen_cnt, noanswer_cnt, busy_cnt, failed_cnt, run, stoplist_cnt) SELECT n.id, 3, NOW(), 0, 1, n.number, 'task1', 'Test task 1', 0, '0000-00-00 00:00:00', 0, 0, 0, 0, 0, 0, 1, 0 FROM numbers AS n; -- Заполняем таблицу случайными номерами для оператора life INSERT INTO numbers (number) SELECT CONCAT(prefix, LPAD(FLOOR(RAND() * 10000000), 7, '0')) FROM ( SELECT '063' AS prefix UNION ALL SELECT '073' UNION ALL SELECT '093' ) AS prefixes CROSS JOIN ( SELECT 1 AS n FROM seq_1_to_100 ) AS numbers; -- Перемешиваем номера UPDATE numbers AS n JOIN ( SELECT n1.id, n2.number FROM numbers AS n1 JOIN numbers AS n2 ON n1.id <> n2.id JOIN ( SELECT n1.id, FLOOR(RAND() * (MAX(n2.id) - MIN(n2.id) + 1)) + MIN(n2.id) AS new_id FROM numbers AS n1 JOIN numbers AS n2 ) AS r ON n1.id = r.id ) AS t ON n.id = t.id SET n.number = t.number; -- Вставляем данные в таблицу pbxu_autocallcampaings_shedule INSERT INTO pbxu_autocallcampaings_shedule (id, autocallcampaing_id, insert_date, in_work, attempt_cnt, phone_numbers, task_id, task_name, res, res_date, bill_sec, answer_cnt, listen_cnt, noanswer_cnt, busy_cnt, failed_cnt, run, stoplist_cnt) SELECT id, 1, NOW(), 0, 1, number, 'task1', 'Test task 1', 0, '0000-00-00 00:00:00', 0, 0, 0, 0, 0, 0, 1, 0 FROM numbers; -- Удаляем временную таблицу DROP TABLE numbers; SELECT * FROM pbxu_autocallcampaings_shedule; select count(run) as run_count from pbxu_autocallcampaings_shedule; delimiter | CREATE PROCEDURE check1() BEGIN SELECT autocallcampaing_id, count(*) as run_count FROM pbxu_autocallcampaings_shedule WHERE autocallcampaing_id = 1 AND answer_cnt = 0 AND listen_cnt = 0 AND noanswer_cnt = 0 AND busy_cnt = 0 AND failed_cnt = 0; END| delimiter ; CALL check1 ();
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