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 Peoples ( ID int primary key, NameAbbreviation varchar(255), Birthday timestamptz default now(), "Status" varchar(255) ); CREATE TABLE Phone ( PeopleID int, Phone int, "Comment" varchar(255) ); create unique index people_phone_idx ON Phone (PeopleID, Phone); -- ALTER TABLE Phone ADD CONSTRAINT "user_phone_ref" FOREIGN KEY (PeopleID) REFERENCES Peoples(ID); CREATE TABLE Address ( PeopleID int, Title varchar(255), "Comment" varchar(255) ); create unique index people_address_idx ON Address (PeopleID, Title); -- ALTER TABLE Address ADD CONSTRAINT "user_address_ref" FOREIGN KEY (PeopleID) REFERENCES Peoples(ID); -- Люди INSERT INTO Peoples (ID, NameAbbreviation, Birthday, "Status") VALUES (1, 'Иванов И. И.', '2.12.1990', 'женат'); INSERT INTO Peoples (ID, NameAbbreviation, Birthday, "Status") VALUES (2, 'Иванов И. И.', '9.18.2001', 'холост'); INSERT INTO Peoples (ID, NameAbbreviation, Birthday, "Status") VALUES (3, 'Петров П. П.', '4.23.1983', 'женат'); INSERT INTO Peoples (ID, NameAbbreviation, Birthday, "Status") VALUES (4, 'Васильев В. В.', '5.21.1998', 'холост'); INSERT INTO Peoples (ID, NameAbbreviation, Birthday, "Status") VALUES (5, 'Кузьмин К.К.', '5.21.2020', 'холост'); -- Телефоны INSERT INTO Phone (PeopleID, Phone, "Comment") VALUES (1, 123, 'Личный'); INSERT INTO Phone (PeopleID, Phone, "Comment") VALUES (1, 124, 'Личный'); INSERT INTO Phone (PeopleID, Phone, "Comment") VALUES (1, 125, 'Личный'); INSERT INTO Phone (PeopleID, Phone, "Comment") VALUES (1, 126, 'Личный'); INSERT INTO Phone (PeopleID, Phone, "Comment") VALUES (1, 127, 'Личный'); INSERT INTO Phone (PeopleID, Phone, "Comment") VALUES (2, 527, 'Личный'); INSERT INTO Phone (PeopleID, Phone, "Comment") VALUES (3, 234, 'Личный'); INSERT INTO Phone (PeopleID, Phone, "Comment") VALUES (4, 235, 'Личный'); INSERT INTO Phone (PeopleID, Phone, "Comment") VALUES (11, 456, 'Личный'); INSERT INTO Phone (PeopleID, Phone, "Comment") VALUES (12, 999, 'Личный'); INSERT INTO Phone (PeopleID, Phone, "Comment") VALUES (13, 997, 'Личный'); INSERT INTO Phone (PeopleID, Phone, "Comment") VALUES (14, 995, 'Личный'); INSERT INTO Phone (PeopleID, Phone, "Comment") VALUES (15, 993, 'Личный'); -- Адреса INSERT INTO Address (PeopleID, Title, "Comment") VALUES (1, 'Можга', 'Место рождения'); INSERT INTO Address (PeopleID, Title, "Comment") VALUES (1, 'Казань', 'По прописке'); INSERT INTO Address (PeopleID, Title, "Comment") VALUES (1, 'Москва', 'Рабочий'); INSERT INTO Address (PeopleID, Title, "Comment") VALUES (2, 'Санкт-Петербург', 'По прописке'); INSERT INTO Address (PeopleID, Title, "Comment") VALUES (3, 'Москва', 'По прописке'); INSERT INTO Address (PeopleID, Title, "Comment") VALUES (4, 'Белгород', 'По прописке'); INSERT INTO Address (PeopleID, Title, "Comment") VALUES (5, 'Уфа', 'По прописке'); INSERT INTO Address (PeopleID, Title, "Comment") VALUES (6, 'Сочи', 'По прописке'); INSERT INTO Address (PeopleID, Title, "Comment") VALUES (7, 'Киров', 'Рабочий'); INSERT INTO Address (PeopleID, Title, "Comment") VALUES (8, 'Владивосток', 'Место рождения'); INSERT INTO Address (PeopleID, Title, "Comment") VALUES (9, 'Рязань', 'Рабочий'); INSERT INTO Address (PeopleID, Title, "Comment") VALUES (10, 'Хабаровск', 'Место рождения'); -- Получить список всех таблиц со схемами -- SELECT * FROM INFORMATION_SCHEMA.TABLES;
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
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