- Esecutori
-
Impara
Impara Python Esempi eseguibili, NumPy, pandas e altro Impara l'IA / Machine LearningReti neurali, ML e LLM da zero Impara C e C++ Puntatori, memoria, STL e C++ moderno Impara C#Fondamenti, OOP, LINQ, async ed esercizi .NET Impara MatplotlibGrafici a linee, barre, dispersione e torta con visualizzatori Impara RustOwnership, trait, gestione degli errori e thread Impara GoSlice, interfacce, goroutine e canali Algoritmi Python Ricerca, ordinamento, ricorsione e visualizzazioni O(n) Algoritmi C e C++ Confronta le implementazioni in C e C++ Programmazione per bambini Impara a programmare giocando!
- QuizNuovo
- SfideNuovo
- Per docentiNuovo
- Aggiornamenti
- Offrimi un caffè
Quiz di SQL: EXISTS vs IN
This SQL quiz compares EXISTS and IN subqueries and their negated forms. You will see why NOT IN returns no rows when the list contains a NULL, how NOT EXISTS avoids it and what really differs between the two in modern databases.
Domanda di esempio
Domanda 1 di 10What does this print?
CREATE TABLE customers (id INTEGER, name TEXT);
CREATE TABLE orders (id INTEGER, customer_id INTEGER);
INSERT INTO customers VALUES (1, 'Ann'), (2, 'Bob'), (3, 'Cy');
INSERT INTO orders VALUES (10, 1), (11, 1), (12, 3);
SELECT name
FROM customers c
WHERE EXISTS (SELECT 1 FROM orders o WHERE o.customer_id = c.id)
ORDER BY name;
Mostra la risposta
B. Ann
Cy EXISTS is true when the correlated subquery finds at least one row for that customer. Like IN, it never repeats a customer, no matter how many orders match.
Cosa copre questo quiz
EXISTS (correlated subquery)and its select listINvsEXISTSfor semi-joins- The
NOT INwith NULL trap - Fixing it with
NOT EXISTSorIS NOT NULL - How optimizers treat IN and EXISTS
Domande frequenti
Serve un account?
No. Chiunque può giocare. Accedi per salvare XP, serie, badge e cronologia.
Posso rifarlo?
Sì. Il tuo miglior punteggio resta salvato, e domande e risposte vengono mescolate ogni volta.