Compilatore MySQL online

Scrivi ed esegui query MySQL online su un vero server MySQL 8.4. Database di esempio, vista dello schema e risultati in tabelle. Gratis, senza registrazione.

247 esecuzioni totali (247 questo mese)
Incorpora

Premi Esegui SQL per vedere qui i risultati.

Metti alla prova il tuo SQL con i quiz

Quiz brevi con codice da leggere ed eseguire: rispondi, leggi la spiegazione e guadagna XP e badge.

Tutti i quiz di SQL
Facile SQL Basics

SELECT & WHERE

Pick the columns you want and keep only the rows that match a condition.

Cosa copre questo quiz
  • Choosing columns with SELECT and SELECT *
  • Filtering rows with WHERE and comparison operators
  • Combining conditions with AND, OR and parentheses
#select#filtering
10 domande · ~5 min · 1 partita Inizia
Facile SQL Basics

ORDER BY & LIMIT

Sort query results and keep only the first few rows.

Cosa copre questo quiz
  • Sorting with ORDER BY, ASC and DESC
  • Breaking ties with a second sort column
  • Keeping the first rows with LIMIT and skipping rows with OFFSET
#sorting#select
10 domande · ~5 min Inizia
Facile SQL Basics

DISTINCT

Remove duplicate rows from a result and count unique values.

Cosa copre questo quiz
  • Removing duplicate rows with SELECT DISTINCT
  • DISTINCT applies to the whole row, not one column
  • Counting unique values with COUNT(DISTINCT column)
#select#duplicates
10 domande · ~5 min Inizia
Facile SQL Basics

LIKE, IN & BETWEEN

Filter rows with text patterns, lists of values and ranges.

Cosa copre questo quiz
  • Pattern matching with LIKE, % and _
  • Case sensitivity of LIKE in SQLite, MySQL and PostgreSQL
  • Checking a list of values with IN and NOT IN
#filtering#patterns
10 domande · ~5 min Inizia
Medio SQL Basics

NULL Values

Learn how SQL treats missing values in comparisons, calculations and filters.

Cosa copre questo quiz
  • Why = NULL never matches and IS NULL does
  • NULL in arithmetic and comparisons like <>
  • Replacing missing values with COALESCE
#null#filtering
10 domande · ~6 min · 1 partita Inizia
Facile Aggregates & GROUP BY

COUNT, SUM, AVG, MIN & MAX

Turn many rows into one number with the five core aggregate functions.

Cosa copre questo quiz
  • Counting rows with COUNT(*)
  • Totals and averages with SUM and AVG
  • MIN and MAX on numbers and text
#aggregates#select
10 domande · ~5 min Inizia
Medio Aggregates & GROUP BY

GROUP BY

Split rows into groups and calculate a total, count or average for each one.

Cosa copre questo quiz
  • One result row per group with GROUP BY
  • Aggregates per group like SUM, COUNT and AVG
  • Grouping by more than one column
#group-by#aggregates
10 domande · ~6 min Inizia
Medio Aggregates & GROUP BY

HAVING

Filter groups by their totals, counts or averages after GROUP BY.

Cosa copre questo quiz
  • Filtering groups with HAVING
  • WHERE (rows, before grouping) vs HAVING (groups, after)
  • Using WHERE and HAVING in the same query
#having#group-by
10 domande · ~6 min Inizia

Come eseguire MySQL online

  1. Parti da un database di esempio (Dipendenti o Negozio) o da uno vuoto, e guarda le sue tabelle nella scheda Schema.
  2. Scrivi le query e premi Esegui SQL o Ctrl + Invio. Ogni istruzione ha la sua tabella di risultati; seleziona una parte del codice per eseguire solo quella.
  3. Ogni esecuzione MySQL riparte dal database di esempio ed esegue tutto l’editor, quindi lascia lì le tue istruzioni CREATE TABLE e INSERT.
  4. Esporta qualsiasi risultato in CSV, oppure premi Condividi per copiare un link con le tue query.
  5. Bloccato su una query? Genera scrive SQL da una descrizione, Spiega ti guida nella query, Correggi codice sistema gli errori e Ottimizza rende la query più veloce e chiara.

SQLite, PostgreSQL o MySQL?

SQLitePostgreSQLMySQL
Ideale perImparare SQL, test veloci, colloquiEsercitarsi con l'SQL di un vero server: funzioni finestra, JSON, tipi rigidiEsercitarsi proprio su MySQL: AUTO_INCREMENT, LIMIT, procedure
AvvioImmediatoQualche secondo al primo avvio (scarica circa 3 MB)Immediato (gira sul nostro server)
TipiFlessibili: qualsiasi valore va in qualsiasi colonnaRigidi: INTEGER, NUMERIC, DATE, JSONB e altriTipi MySQL: INT, VARCHAR, DECIMAL, DATETIME, JSON
Funziona suIl tuo browser, senza account e senza serverIl nostro server MySQL 8.4, in un database privato cancellato dopo ogni esecuzione

Preferisci un database che gira nel browser? Il Compilatore SQL online ha anche SQLite e PostgreSQL.

Buono a sapersi

  • Gira su MySQL 8.4: AUTO_INCREMENT, i backtick, LIMIT, SHOW TABLES e DESCRIBE funzionano così come sono.
  • Stored procedure e trigger funzionano con DELIMITER //, come nel client mysql.
  • Un’esecuzione dura al massimo 10 secondi e modifica al massimo 50.000 righe; ogni risultato mostra le prime 1.000 righe.
  • Ogni esecuzione usa un database privato cancellato subito dopo; il tuo SQL resta in questo browser.
  • Importa un file .sql o .csv: finisce nell’editor e viene eseguito con esso.
  • Passa il Motore a SQLite o PostgreSQL per provare la stessa query su un altro database.

Query MySQL da provare

  • Tabella con auto-incremento: CREATE TABLE notes (id INT AUTO_INCREMENT PRIMARY KEY, body VARCHAR(200));
  • Prime righe: SELECT name, salary FROM employees ORDER BY salary DESC LIMIT 3;
  • Un elenco per gruppo: SELECT department_id, GROUP_CONCAT(name SEPARATOR ', ') FROM employees GROUP BY department_id;
  • Formattare una data: SELECT name, DATE_FORMAT(hired_on, '%M %Y') FROM employees;
  • Vedere le tabelle: SHOW TABLES; DESCRIBE employees;

Frequently asked questions

È un vero server MySQL?

Sì. Le tue query girano su MySQL 8.4, quindi la sintassi MySQL funziona così com’è: AUTO_INCREMENT, backtick, LIMIT, SHOW TABLES, DESCRIBE, GROUP_CONCAT, DATE_FORMAT, stored procedure e trigger.

Le mie tabelle vengono conservate?

Ogni esecuzione riceve un database nuovo e privato, cancellato subito dopo, quindi nessun altro vede le tue tabelle. Il tuo SQL resta in questo browser.

Perché le mie tabelle spariscono all’esecuzione successiva?

Ogni esecuzione riparte dal database di esempio ed esegue tutto l’editor. Lascia i tuoi CREATE TABLE e INSERT nell’editor; anche i file importati vengono aggiunti lì.

Quali sono i limiti?

Un’esecuzione dura al massimo 10 secondi e inserisce, modifica o cancella al massimo 50.000 righe; ogni risultato mostra fino a 1.000 righe. È più che sufficiente per studiare, fare i compiti e prepararsi ai colloqui.

Posso scrivere stored procedure e trigger?

Sì. Usa DELIMITER // e chiudi la procedura con //, come nel client mysql. CALL la esegue e mostra i risultati.

È gratis?

Sì. L’editor MySQL, i database di esempio e l’esportazione CSV sono gratis e non serve un account.