Summary: in this tutorial, you will learn how to use the SQLite
Introduction to SQLite
EXCEPT operator compares the result sets of two queries and returns distinct rows from the left query that are not output by the right query.
The following shows the syntax of the
This query must conform to the following rules:
- First, the number of columns in the select lists of both queries must be the same.
- Second, the order of the columns and their types must be comparable.
CREATE TABLE t1(
INSERT INTO t1(v1)
CREATE TABLE t2(
INSERT INTO t2(v2)
The following statement illustrates how to use the
EXCEPT operator to compare result sets of two queries:
The output is 1.
The following picture illustrates the
We will use the
albums tables from the sample database for the demonstration.
The following statement finds artist ids of artists who do not have any album in the
The output is as follows:
In this tutorial, you have learned how to use the SQLite
EXCEPT operator to compare two queries and return unique rows from the left query that are not output by the right query.