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 branch_offices (branch_code int primary key, location varchar2(255), opening_hours varchar2(255), list_of_services varchar2(255), phone_number char(5) ); CREATE TABLE departments (department_code int, department_name varchar2(255), opening_hours varchar2(255), branch int, equipment int, CONSTRAINT departments_pk PRIMARY KEY (department_code), CONSTRAINT branch_offices_departments_fk FOREIGN KEY (branch) REFERENCES branch_offices(branch_code) ); CREATE TABLE staff (personal_access_code int, full_name varchar2(255), date_of_birth date, position varchar2(255), phone_number char(5), department int, CONSTRAINT staff_pk PRIMARY KEY (personal_access_code), CONSTRAINT departments_staff_fk FOREIGN KEY (department) REFERENCES departments(department_code) ); CREATE TABLE clients (client_code int, full_name varchar2(255), TIN int, passport_information int, personal_bank_account int, personal_manager int, CONSTRAINT clients_pk PRIMARY KEY (client_code), CONSTRAINT staff_clients_fk FOREIGN KEY (personal_manager) REFERENCES staff(personal_access_code) ); CREATE TABLE active_customer_transactions (transaction_number int, date_of_transaction date, organisation int, transaction_amount int, assignment_of_the_operation varchar2(255), CONSTRAINT active_customer_transactions_pk PRIMARY KEY (transaction_number), CONSTRAINT clients_active_customer_transactions_fk FOREIGN KEY (organisation) REFERENCES clients(client_code) ); insert into branch_offices values ('10025', 'Москва, ул. Недорубова, 5', '9:00-22:00', 'Инвестиции, страхование', '45843' ), ('10026', 'Санкт-Петербург, ул. Гагаринская, 32', '8:00-21:00', 'Поддержка моб. приложений, факторинг', '27698'), ('10027', 'Казань, ул.Островского, 21', '9:00-22:30', 'Банковское дело, кредиты, депозиты', '69756'), ('10028', 'Нижний Новогород, ул. Маслякова, 13', '8:30-22:00', 'Управление активами, обмен валюты', '21856'), ('10030', 'Калининград, ул. Дзержинского, 27', '9:00-21:30', 'Бизнес услуги, инвестиционные консультации', '85367'); insert into departments values ('01', 'Департамент статистики', '9:00-22:00', '10025', '4'), ('02', 'Департамент бух. учёта и отчётности', '8:00-21:00', '10026', '6'), ('03', 'Департамент исследований и прогнозирования', '9:00-22:30', '10027', '21'), ('04', 'Департмамент нац. платёжной системы', '8:30-22:00', '10028', '8'), ('05', 'Департмамент регулирования бух. учёта', '9:00-21:30', '10030', '17'); insert into staff values ('2035', 'Васильев Игорь Владиславович', '12-OCT-92', 'Клиентский менеджер', '2957', '03'), ('7458', 'Кардава Инна Фёдоровна', '02-JUN-96', 'Главный бухгалтер', '9675', '02'), ('3067', 'Сидорова Анна Алексеевна', '26-MAR-87', 'Кредитный аналитик', '8536', '01'), ('9805', 'Казанцев Кирилл Валерьевич', '09-JAN-94', 'Финансовый консультант', '1866', '04'), ('8575', 'Кожевников Иван Романович', '29-NOV-99', 'Операционный менеджер', '3943', '05'); insert into clients values ('3045', 'Баринов Виктор Олегович', '200056388564', '4567345006', '386756', '3067'), ('3023', 'Хотченкова Светлана Сергеевна', '956344729110', '4300648675', '200674', '8575'), ('6784', 'Зайцева Кристина Артёмовна', '894722297884', '4000237690', '267510', '2035'), ('1964', 'Николенко Павел Данилович', '3500055768001', '4967148607', '957368', '9805'), ('1927', 'Кисляков Андрей Петрович', '774967500322', '4672005476', '903767', '7458'); insert into active_customer_transactions values ('60039576', '14-SEP-24', '3023', '55000', 'Банковский перевод'), ('58030577', '21-SEP-24', '1964', '200000', 'Оплата услуг'), ('30005865', '27-SEP-24', '3045', '13500', 'Платёж по кредиту'), ('23500045', '01-OCT-24', '1927', '25000', 'Оплата услуг'), ('56900004', '09-OCT-24', '6784', '40000', 'Внесение депозита'); Alter table active_customer_transactions add (transaction_status varchar2(255) default 'Unknown' NOT NULL); UPDATE active_customer_transactions SET transaction_status = CASE WHEN transaction_number IN ('60039576', '23500045', '30005865') THEN 'завершена' ELSE 'в обработке' END; alter table clients add (personal_bank_account_2 VARCHAR2(255)); update clients set personal_bank_account_2 = TO_CHAR(personal_bank_account); alter table clients drop column personal_bank_account; alter table clients rename column personal_bank_account_2 to personal_bank_account; update active_customer_transaction set date_of_transaction = case when transaction_number = 60039576 then '15-SEP-24' when transaction_number = 23500045 then '05-OCT-24' else date_of_transaction end; select * from Branch_offices; select * from Departments; select * from Staff; select * from Clients; select * from Active_customer_transactions;
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