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 EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE SCHEMA IF NOT EXISTS waybills; -- triggers CREATE OR REPLACE FUNCTION set_update() RETURNS TRIGGER AS $$ BEGIN NEW.updated_at = NOW(); NEW.increment = NEXTVAL(TG_ARGV[0]); RETURN NEW; END; $$ LANGUAGE plpgsql; CREATE TABLE IF NOT EXISTS waybills.contractor_integrations ( park_contractor_profile_id TEXT NOT NULL, provider TEXT NOT NULL, external_id TEXT NOT NULL, meta JSONB, is_deleted BOOLEAN NOT NULL DEFAULT FALSE, updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), increment BIGSERIAL NOT NULL, PRIMARY KEY (park_contractor_profile_id, provider) ); CREATE INDEX IF NOT EXISTS idx__contractors_park_contractor_profile_id ON waybills.contractor_integrations (park_contractor_profile_id); DROP TRIGGER IF EXISTS trigger_update ON waybills.contractors; CREATE TRIGGER trigger_update BEFORE UPDATE ON waybills.contractor_integrations FOR EACH ROW EXECUTE PROCEDURE set_update('waybills.contractor_integrations_increment_seq'); CREATE TYPE waybills.subscription_type AS ENUM ('personal', 'park'); CREATE TABLE IF NOT EXISTS waybills.subscriptions ( provider TEXT NOT NULL, external_id TEXT NOT NULL, subscription_type waybills.subscription_type NOT NULL, expires_at TIMESTAMPTZ, meta JSONB, is_deleted BOOLEAN NOT NULL DEFAULT FALSE, updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), increment BIGSERIAL NOT NULL, PRIMARY KEY (provider, external_id) ); DROP TRIGGER IF EXISTS trigger_update ON waybills.subscriptions; CREATE TRIGGER trigger_update BEFORE UPDATE ON waybills.subscriptions FOR EACH ROW EXECUTE PROCEDURE set_update('waybills.subscriptions_increment_seq'); INSERT INTO waybills.contractor_integrations (park_contractor_profile_id, provider, external_id) VALUES ('1_1', 'aaaa', 'aaa1'), ('1_2', 'aaaa', 'aaa2'), ('1_1', 'bbbb', 'bbb1'); select * from waybills.contractor_integrations; select '2024-11-27 00:00:00.0000'::timestamptz + '3 months';
SQL
Server:
MySQL 5.7
MySQL 5.7 Sakila (ReadOnly)
MySQL 8.0
MySQL 8.0 Sakila (ReadOnly)
MariaDB 11.5
SQLite 3
SQLite 3 Preloaded
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