SELECT
statement to choose the name
column from the customer
table.WHERE
clause to filter out the customers based on the referee_id
.WHERE
clause, check if referee_id
is not equal to 2 using <>
or !=
.OR
operator to include an additional condition where referee_id
is NULL
.id = 2
are selected, including those with no referrer.erDiagram Customer { int id PK varchar name int referee_id FK }