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
-- Создание таблицы TARIFS CREATE TABLE TARIFS ( ID NUMBER PRIMARY KEY, NAME VARCHAR2(255) NOT NULL, COST NUMBER(10, 2) NOT NULL ); -- Создание таблицы CLIENTS CREATE TABLE CLIENTS ( ID NUMBER PRIMARY KEY, NAME VARCHAR2(255) NOT NULL, PLACE_OF_BIRTH VARCHAR2(255) NOT NULL, DATE_OF_BIRTH DATE NOT NULL, ADDRESS VARCHAR2(255), PASSPORT VARCHAR2(255) UNIQUE NOT NULL ); -- Создание таблицы PRODUCT_TYPE CREATE TABLE PRODUCT_TYPE ( ID NUMBER PRIMARY KEY, NAME VARCHAR2(255) NOT NULL, BEGIN_DATE DATE NOT NULL, END_DATE DATE, TARIF_REF NUMBER, FOREIGN KEY (TARIF_REF) REFERENCES TARIFS(ID) ); -- Создание таблицы PRODUCTS CREATE TABLE PRODUCTS ( ID NUMBER PRIMARY KEY, PRODUCT_TYPE_ID NUMBER NOT NULL, NAME VARCHAR2(255) NOT NULL, CLIENT_REF NUMBER NOT NULL, OPEN_DATE DATE NOT NULL, CLOSE_DATE DATE, CONSTRAINT FK_PRODUCTS_PRODUCT_TYPE FOREIGN KEY (PRODUCT_TYPE_ID) REFERENCES PRODUCT_TYPE(ID), CONSTRAINT FK_PRODUCTS_CLIENTS FOREIGN KEY (CLIENT_REF) REFERENCES CLIENTS(ID) ); -- Создание таблицы ACCOUNTS CREATE TABLE ACCOUNTS ( ID NUMBER PRIMARY KEY, NAME VARCHAR2(255) NOT NULL, SALDO NUMBER(10, 2) DEFAULT 0.00, CLIENT_REF NUMBER NOT NULL, OPEN_DATE DATE NOT NULL, CLOSE_DATE DATE, PRODUCT_REF NUMBER, ACC_NUM VARCHAR2(50) UNIQUE NOT NULL, CONSTRAINT FK_ACCOUNTS_CLIENTS FOREIGN KEY (CLIENT_REF) REFERENCES CLIENTS(ID), CONSTRAINT FK_ACCOUNTS_PRODUCTS FOREIGN KEY (PRODUCT_REF) REFERENCES PRODUCTS(ID) ); -- Создание таблицы RECORDS CREATE TABLE RECORDS ( ID NUMBER PRIMARY KEY, DT NUMBER(1) NOT NULL CHECK (DT IN (0, 1)), ACC_REF NUMBER NOT NULL, OPER_DATE DATE NOT NULL, SUM NUMBER(10, 2) NOT NULL, CONSTRAINT FK_RECORDS_ACCOUNTS FOREIGN KEY (ACC_REF) REFERENCES ACCOUNTS(ID) );
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