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 Studenti( id integer NOT NULL AUTO_INCREMENT, nome varchar(255), cognome varchar(255), classe integer, sezione varchar(2), PRIMARY KEY(id) ); CREATE TABLE Materia( id integer NOT NULL AUTO_INCREMENT, nome_materia varchar(255), nome_docente varchar(255), cognome_docente varchar(255), PRIMARY KEY (id) ); CREATE TABLE Registro( id integer NOT NULL AUTO_INCREMENT, voto integer, id_studente integer, id_materia integer, PRIMARY KEY(id), FOREIGN KEY (id_studente) REFERENCES Studenti(id) ON DELETE CASCADE, FOREIGN KEY (id_materia) REFERENCES Materia(id) ON DELETE CASCADE ); INSERT INTO Studenti(nome, cognome, classe, sezione) VALUES ('Gian Tommaso', 'Sanna', 4, 'BS'); INSERT INTO Studenti(nome, cognome, classe, sezione) VALUES ('Simone', 'Foschini', 4, 'BS'); INSERT INTO Studenti(nome, cognome, classe, sezione) VALUES ('Caterina', 'Rocca', 4, 'BS'); INSERT INTO Studenti(nome, cognome, classe, sezione) VALUES ('Carlo', 'Monti', 4, 'BS'); INSERT INTO Studenti(nome, cognome, classe, sezione) VALUES ('Veronica', 'Cimbri', 4, 'BS'); INSERT INTO Studenti(nome, cognome, classe, sezione) VALUES ('Giovanni', 'Sabbioni', 4, 'BS'); INSERT INTO Studenti(nome, cognome, classe, sezione) VALUES ('Alessandro', 'Cesaretti', 4, 'BS'); INSERT INTO Studenti(nome, cognome, classe, sezione) VALUES ('Veronica', 'Legnani', 4, 'BS'); INSERT INTO Materia(nome_materia, nome_docente, cognome_docente) VALUES ('Scienze', 'Alfreda', 'Zanforlin'); INSERT INTO Materia(nome_materia, nome_docente, cognome_docente) VALUES ('Filosofia, Storia e Religione', 'Giacomo', 'Bettini'); INSERT INTO Materia(nome_materia, nome_docente, cognome_docente) VALUES ('Informatica', 'Alessandro', 'Serra'); INSERT INTO Registro(voto, id_studente, id_materia) VALUES (10, 1, 3); INSERT INTO Registro(voto, id_studente, id_materia) VALUES (2, 1, 2); INSERT INTO Registro(voto, id_studente, id_materia) VALUES (3, 4, 1); INSERT INTO Registro(voto, id_studente, id_materia) VALUES (2, 4, 3); INSERT INTO Registro(voto, id_studente, id_materia) VALUES (8, 3, 3); INSERT INTO Registro(voto, id_studente, id_materia) VALUES (9, 3, 3); SELECT nome, cognome, AVG(voto) as Media, COUNT(voto) as NumeroVoti FROM Studenti, Materia, Registro WHERE id_materia = Materia.id AND id_studente = Studenti.id GROUP BY nome, cognome; DELETE FROM Studenti WHERE id=4; SELECT nome, cognome, AVG(voto) as Media, COUNT(voto) as NumeroVoti FROM Studenti, Materia, Registro WHERE id_materia = Materia.id AND id_studente = Studenti.id GROUP BY nome, cognome
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