EXISTS Operator in SQL

Introduction

The SQL EXISTS operator checks whether a subquery returns at least one row. It does not use the projected values as output; it asks one logical question: does a qualifying related row exist?

SELECT customer_id, customer_name
FROM customers c
WHERE EXISTS (
  SELECT 1
  FROM orders o
  WHERE o.customer_id = c.customer_id
);

This returns customers with at least one order. The inner rows are not added to the result, and multiple matching orders do not duplicate the customer. EXISTS is therefore a natural expression for parent-with-child, authorization, eligibility, and relationship-presence rules.

Basic EXISTS Syntax

SELECT outer_columns
FROM outer_table o
WHERE EXISTS (
  SELECT 1
  FROM related_table r
  WHERE r.foreign_key = o.primary_key
);

The subquery is commonly correlated with the current outer row. For each conceptual outer candidate, the database determines whether the inner conditions can produce at least one row.

EXISTS Returns TRUE or FALSE

If the subquery produces one or more rows, EXISTS is TRUE. If it produces zero rows, EXISTS is FALSE. That Boolean result determines whether the outer row passes WHERE.

EXISTS does not count matches, return the first inner value, or attach inner columns. Its purpose is only existence testing.

Why SELECT 1 Is Common

The selected value inside EXISTS is logically irrelevant. SELECT 1, SELECT NULL, and often SELECT * all express the same existence rule because a returned row is what matters.

WHERE EXISTS (
  SELECT 1
  FROM order_items i
  WHERE i.order_id = o.order_id
)

SELECT 1 communicates intent clearly: no inner data is requested by the outer query. Do not mistake it for a performance instruction that every engine must execute literally.

What Correlation Means

A correlated subquery references a column from the outer query. That reference creates the relationship being tested.

WHERE o.customer_id = c.customer_id

Without this condition, the subquery may be uncorrelated and return the same TRUE or FALSE result for every outer row. Forgetting correlation can therefore return all customers or none.

Customers with Qualifying Orders

SELECT c.customer_id, c.customer_name
FROM customers c
WHERE EXISTS (
  SELECT 1
  FROM orders o
  WHERE o.customer_id = c.customer_id
    AND o.status = 'PAID'
);

This asks for customers with at least one paid order. A customer with only cancelled orders does not qualify, even though orders exist. Existence always applies to the complete inner predicate.

Multiple Inner Conditions

The subquery can combine status, amount, date, tenant, and soft-delete conditions.

WHERE EXISTS (
  SELECT 1
  FROM orders o
  WHERE o.customer_id = c.customer_id
    AND o.tenant_id = c.tenant_id
    AND o.status IN ('PAID', 'SHIPPED')
    AND o.total_amount >= :minimum_amount
    AND o.created_at >= :period_start
    AND o.created_at <  :period_end
    AND o.deleted_at IS NULL
)

Each condition narrows what counts as an existing qualifying row. Keep compatible types and explicit time boundaries.

Tenant Scope and Authorization

Existence in another tenant must never authorize an outer row. Correlate both the business key and tenant key where shared identifiers or partitioned data require it.

WHERE c.tenant_id = :tenant_id
  AND EXISTS (
    SELECT 1
    FROM orders o
    WHERE o.tenant_id = c.tenant_id
      AND o.customer_id = c.customer_id
      AND o.status = 'PAID'
  )

Server-controlled identity and authorization context must define tenant scope. Client-supplied IDs are data, not proof of access.

EXISTS with AND and OR

AND can require several independent facts. OR can permit alternative access paths, but grouping is essential.

WHERE organization_id = :organization_id
  AND (is_public = 1
       OR owner_user_id = :user_id
       OR EXISTS (
         SELECT 1
         FROM document_permission p
         WHERE p.document_id = d.document_id
           AND p.user_id = :user_id
           AND p.can_read = 1
       ))

Without parentheses, one OR branch can bypass the organization condition. Authorization queries need explicit grouping and adversarial tests.

EXISTS versus JOIN

Use EXISTS when related rows determine eligibility but their columns are not needed. Use JOIN when the result must include inner-table data.

-- Eligibility only.
SELECT c.customer_id, c.customer_name
FROM customers c
WHERE EXISTS (
  SELECT 1 FROM orders o
  WHERE o.customer_id = c.customer_id
);

-- Relationship rows are required.
SELECT c.customer_name, o.order_id, o.total_amount
FROM customers c
JOIN orders o ON o.customer_id = c.customer_id;

A one-to-many JOIN can multiply customer rows. EXISTS does not because it returns one Boolean answer per outer row.

Semi-Join Concept

Positive EXISTS often represents a semi-join: return an outer row when at least one inner match exists, without returning or multiplying by inner rows. Optimizers may implement EXISTS using a physical semi-join or another equivalent strategy.

This explains why JOIN plus DISTINCT is often an unnecessary substitute. DISTINCT may remove duplicates after a larger join result has already been formed.

EXISTS versus IN

IN asks whether a value belongs to a returned set. EXISTS asks whether a row satisfying a relationship and filters exists.

WHERE customer_id IN (
  SELECT customer_id FROM orders WHERE status = 'PAID'
)

WHERE EXISTS (
  SELECT 1 FROM orders o
  WHERE o.customer_id = c.customer_id
    AND o.status = 'PAID'
)

For positive membership, both may produce equivalent plans. EXISTS is often clearer for multi-column correlation; IN is concise for single-value membership. Measure actual plans instead of assuming one is always faster.

EXISTS and NULL Values

The projected value inside EXISTS can be NULL and the predicate can still be TRUE because the subquery returned a row.

WHERE EXISTS (SELECT NULL FROM orders o WHERE o.customer_id = c.customer_id)

However, NULL in correlation columns still follows ordinary comparison rules. If both sides are NULL, o.code = c.code is UNKNOWN and does not match. Use a deliberate null-safe comparison if missing keys are supposed to correspond.

NOT EXISTS

NOT EXISTS is TRUE when its subquery returns zero rows. It expresses anti-existence:

SELECT c.customer_id, c.customer_name
FROM customers c
WHERE NOT EXISTS (
  SELECT 1
  FROM orders o
  WHERE o.customer_id = c.customer_id
);

This returns customers without orders. It is a common anti-join pattern and handles nullable inner data more predictably than NOT IN.

NOT EXISTS versus NOT IN

NOT IN can return no expected rows when its list or subquery contains NULL. NOT EXISTS tests whether a matching row exists and is not poisoned by an unrelated NULL projection.

WHERE NOT EXISTS (
  SELECT 1
  FROM blocked_customer b
  WHERE b.customer_id = c.customer_id
)

The correlation comparison can still involve NULL, so model keys carefully, but NOT EXISTS avoids the classic nullable-set trap.

No Rows versus No Qualifying Rows

These are different requirements:

-- Customer has no orders of any kind.
WHERE NOT EXISTS (
  SELECT 1 FROM orders o
  WHERE o.customer_id = c.customer_id
)

-- Customer has no paid orders, but may have other orders.
WHERE NOT EXISTS (
  SELECT 1 FROM orders o
  WHERE o.customer_id = c.customer_id
    AND o.status = 'PAID'
)

Place qualifiers inside the subquery whose absence is being tested.

NOT EXISTS versus LEFT JOIN

A LEFT JOIN anti-join can also find missing relationships:

LEFT JOIN orders o ON o.customer_id = c.customer_id
WHERE o.order_id IS NULL

Test a non-nullable inner key. Testing an optional column can falsely classify a matched row as absent. NOT EXISTS avoids that particular pitfall and often states the requirement more directly.

Joins Inside EXISTS

The subquery may join several related tables:

WHERE EXISTS (
  SELECT 1
  FROM order_items i
  JOIN products p ON p.product_id = i.product_id
  WHERE i.order_id = o.order_id
    AND p.category_id = :category_id
    AND p.is_active = 1
)

This asks whether an order contains at least one active product in the category. Index every relationship and selective filter according to the workload.

Many-to-Many Relationships

EXISTS naturally tests bridge tables such as user roles, article tags, and student enrollments.

SELECT u.user_id, u.user_name
FROM users u
WHERE EXISTS (
  SELECT 1
  FROM user_role ur
  WHERE ur.user_id = u.user_id
    AND ur.role_code = 'APPROVER'
);

The bridge's unique constraints should prevent duplicate relationships, but duplicates would not change the EXISTS result.

Inventory, Projects, and Account Examples

EXISTS is useful wherever a parent qualifies through at least one related operational row. Inventory search can return products available in any active warehouse:

SELECT p.product_id, p.product_name
FROM products p
WHERE EXISTS (
  SELECT 1
  FROM warehouse_inventory i
  JOIN warehouses w ON w.warehouse_id = i.warehouse_id
  WHERE i.product_id = p.product_id
    AND i.available_quantity > 0
    AND w.is_active = 1
);

A project dashboard can find projects with open overdue tasks, and a fraud screen can find accounts with at least one transaction above a risk threshold. In every case, the complete inner predicate defines the relationship that qualifies the parent.

Hierarchies and Self-Relationships

A hierarchy can use EXISTS against the same table. Managers with active direct reports have at least one employee whose manager_id references them:

SELECT m.employee_id, m.employee_name
FROM employees m
WHERE EXISTS (
  SELECT 1
  FROM employees e
  WHERE e.manager_id = m.employee_id
    AND e.employment_status = 'ACTIVE'
);

NOT EXISTS finds leaf employees without active direct reports. For descendants across many levels, use a recursive CTE or hierarchy feature; a simple correlated EXISTS checks only the relationship stated in its predicate.

Requiring Multiple Independent Relationships

One IN condition often means any listed tag, not every listed tag. Multiple EXISTS predicates can require each relationship independently.

WHERE EXISTS (
  SELECT 1 FROM article_tag t
  WHERE t.article_id = a.article_id AND t.tag_code = 'SQL'
)
AND EXISTS (
  SELECT 1 FROM article_tag t
  WHERE t.article_id = a.article_id AND t.tag_code = 'DATABASE'
)

This requires both tags without multiplying the article row.

Expressing Every Related Row

SQL often expresses “all children satisfy a rule” through double negation: no violating child exists.

WHERE NOT EXISTS (
  SELECT 1
  FROM order_items i
  WHERE i.order_id = o.order_id
    AND (i.quality_status <> 'APPROVED'
         OR i.quality_status IS NULL)
)

The explicit NULL branch treats missing approval as a violation. Without it, UNKNOWN could allow an unapproved row to escape the violation test.

Vacuous Truth

If an order has no items, then no violating item exists, so the previous NOT EXISTS condition is TRUE. This is called vacuous truth. If the requirement is at least one item and all items approved, combine positive existence with no violations:

WHERE EXISTS (
  SELECT 1 FROM order_items i
  WHERE i.order_id = o.order_id
)
AND NOT EXISTS (
  SELECT 1 FROM order_items i
  WHERE i.order_id = o.order_id
    AND (i.quality_status <> 'APPROVED'
         OR i.quality_status IS NULL)
)

EXISTS in CASE

SELECT customer_id,
       CASE
         WHEN EXISTS (
           SELECT 1 FROM orders o
           WHERE o.customer_id = c.customer_id
             AND o.status = 'PAID'
         ) THEN 'Has paid order'
         ELSE 'No paid order'
       END AS payment_activity
FROM customers c;

CASE labels outer rows based on existence without retrieving inner details.

EXISTS in UPDATE

UPDATE can require a related fact in the same statement:

UPDATE customers c
SET loyalty_status = 'ACTIVE'
WHERE c.tenant_id = :tenant_id
  AND EXISTS (
    SELECT 1
    FROM orders o
    WHERE o.tenant_id = c.tenant_id
      AND o.customer_id = c.customer_id
      AND o.status = 'PAID'
  );

Verify affected rows and consider concurrency if the related state can change during the operation.

EXISTS in DELETE

Pattern-based deletion requires a preview using the identical predicate:

SELECT p.product_id
FROM products p
WHERE EXISTS (
  SELECT 1 FROM product_flag f
  WHERE f.product_id = p.product_id
    AND f.flag_code = 'TEST_DATA'
);

DELETE FROM products p
WHERE EXISTS (
  SELECT 1 FROM product_flag f
  WHERE f.product_id = p.product_id
    AND f.flag_code = 'TEST_DATA'
);

Use transactions, scope, audit records, foreign-key review, row limits, and recovery procedures.

Duplicate Inner Rows Do Not Matter

Once one matching row exists, additional matching rows do not change TRUE. DISTINCT and GROUP BY are usually unnecessary in a simple EXISTS subquery.

Remove them unless aggregation or grouping is part of the actual qualification rule. Unnecessary work can obscure intent and complicate plans.

EXISTS versus COUNT Greater Than Zero

-- Clear existence intent.
WHERE EXISTS (
  SELECT 1 FROM orders o
  WHERE o.customer_id = c.customer_id
)

-- Counts matches that are not otherwise needed.
WHERE (SELECT COUNT(*) FROM orders o
       WHERE o.customer_id = c.customer_id) > 0

EXISTS is semantically better when only presence matters. Use COUNT when the count itself determines the rule, such as exactly three orders.

At Least One, Exactly One, and At Least N

EXISTS directly expresses at least one. It does not express exactly one or a minimum count greater than one. Those rules need aggregation or another deliberate formulation.

-- Customers with exactly one active subscription.
SELECT customer_id
FROM subscriptions
WHERE status = 'ACTIVE'
GROUP BY customer_id
HAVING COUNT(*) = 1;

-- Customers with at least three paid orders.
SELECT customer_id
FROM orders
WHERE status = 'PAID'
GROUP BY customer_id
HAVING COUNT(*) >= 3;

Do not combine arbitrary EXISTS predicates and assume they represent multiple distinct rows; the same inner row can satisfy more than one predicate unless their conditions make that impossible.

Correlated Aggregates

EXISTS can contain grouped or aggregate logic when qualification depends on a group:

WHERE EXISTS (
  SELECT 1
  FROM order_items i
  WHERE i.order_id = o.order_id
  GROUP BY i.order_id
  HAVING SUM(i.quantity) >= 100
)

Sometimes a scalar aggregate or pre-aggregated CTE is clearer. Choose the expression that best states the requirement and performs well at scale.

EXISTS and Indexing

The inner correlation column is a primary index candidate. Additional equality and range filters may belong in a composite index.

WHERE o.tenant_id = c.tenant_id
  AND o.customer_id = c.customer_id
  AND o.status = 'PAID'

An index beginning with tenant_id, customer_id, and perhaps status may support efficient existence checks. Exact order depends on query patterns, selectivity, ordering, and write costs.

Correlated Does Not Mean Automatically Slow

SQL is declarative. The optimizer can transform a correlated EXISTS into semi-joins, index probes, hashes, or other strategies. It is not required to execute the subquery independently for every row in a naive loop.

Performance depends on data size, selectivity, indexes, statistics, predicates, and database capabilities. Inspect actual plans rather than judging syntax alone.

Filter Outer and Inner Rows Precisely

Selective outer predicates reduce candidates before existence testing. Precise inner predicates reduce work and prevent false qualification.

WHERE c.tenant_id = :tenant_id
  AND c.status = 'ACTIVE'
  AND EXISTS (
    SELECT 1
    FROM orders o
    WHERE o.tenant_id = c.tenant_id
      AND o.customer_id = c.customer_id
      AND o.created_at >= :period_start
      AND o.created_at <  :period_end
  )

Foreign Keys and Referential Integrity

A foreign key guarantees that a referenced parent exists when a child key is present, but it does not guarantee that a parent has children. EXISTS remains appropriate for parent-with-child queries.

Foreign keys also do not enforce status, date, tenant, or soft-delete qualifications automatically. A customer may have only cancelled orders, so the complete EXISTS predicate must still encode the business rule. Align tenant keys in composite relationships where possible so constraints reinforce query-level correlation.

Sargability and Type Compatibility

Functions or implicit conversions on correlation keys can prevent efficient index access.

-- Prefer compatible stored and parameter types.
WHERE o.customer_id = c.customer_id

-- Avoid unnecessary transformations on indexed keys.
WHERE CAST(o.customer_id AS VARCHAR(30)) = c.external_code

Model relationships with compatible types and normalize data at controlled boundaries.

Execution Plans

Review estimated and actual rows, semi-join or anti-join operators, inner access methods, reads, CPU, memory, spills, and parameter sensitivity. Test outer rows with no matches, one match, and many matches.

A plan that performs well when nearly every parent has a child may differ from one needed when matches are rare. Keep statistics current.

Troubleshooting Incorrect EXISTS Results

If every outer row appears, run the inner query for one outer key and verify the intended correlation is present. If no rows appear, inspect key types, NULL values, tenant conditions, date boundaries, status spelling, and soft-delete filters.

Project diagnostic columns through a temporary JOIN or run the inner query separately for a known parent. EXISTS intentionally hides inner values, so debugging may require exposing the relationship outside the final production query. Confirm semantic correctness before tuning; a fast query with the wrong correlation is still a defect.

Monitoring Existence Workloads

Track execution duration, outer candidate count, qualifying count, reads, and plan changes for important authorization and queue queries. A sudden rise in unmatched parents or qualifying rows can indicate broken ingestion, status mapping, or tenant correlation.

Monitor positive and negative existence paths separately because anti-joins may have different distributions and plans. Avoid logging sensitive identifiers when aggregate telemetry is sufficient.

EXISTS Does Not Define Order or Count

EXISTS does not order outer results. Add ORDER BY with a stable tiebreaker for pagination. ORDER BY inside a plain EXISTS subquery is generally meaningless unless required by another construct.

Adding LIMIT 1 inside EXISTS is often redundant because the logical operator already needs only existence. Avoid syntax that obscures the basic rule unless the target engine and measured workload justify it.

CTEs and Views

A CTE or view can clarify a complex qualifying set:

WITH eligible_orders AS (
  SELECT tenant_id, customer_id
  FROM orders
  WHERE status = 'PAID' AND deleted_at IS NULL
)
SELECT c.customer_id
FROM customers c
WHERE EXISTS (
  SELECT 1 FROM eligible_orders e
  WHERE e.tenant_id = c.tenant_id
    AND e.customer_id = c.customer_id
);

Abstraction can improve readability, but it does not guarantee materialization or performance. Inspect the resulting plan.

EXISTS in API and Repository Design

Application code often needs a Boolean answer such as whether a username is taken, a user can access a document, or an order has a payment. A repository can expose an existence method without retrieving complete related entities.

For authorization, do not return a generic existence answer before applying access scope because that can reveal whether another tenant owns a resource. The existence query must include the caller's trusted organization and permission context.

Batch APIs should avoid issuing one EXISTS query per item when one set-based query can evaluate all candidates. Reduce round trips while preserving the same eligibility semantics.

Existence Checks and Concurrency

A separate “check then insert” sequence has a race: two sessions can both observe absence and then insert duplicates. A unique constraint is the final guard.

Similarly, reading existence and later updating can suffer time-of-check-to-time-of-use changes. Put the related condition in the mutation statement, use an appropriate transaction or locking strategy, and verify affected rows.

Atomic Business Rules

UPDATE inventory i
SET reserved_quantity = reserved_quantity + :requested
WHERE i.product_id = :product_id
  AND i.available_quantity - i.reserved_quantity >= :requested
  AND EXISTS (
    SELECT 1
    FROM warehouse w
    WHERE w.warehouse_id = i.warehouse_id
      AND w.is_active = 1
  );

The affected-row count reports whether all conditions held at mutation time. EXISTS contributes a related fact but does not solve every concurrency problem by itself.

Real-World Eligibility Example

A customer may qualify for an offer only when the account is active, at least one paid order exists in the qualifying period, a verified contact method exists, and no unresolved fraud block exists. Multiple EXISTS and NOT EXISTS predicates can state those independent facts without multiplying the customer row.

SELECT c.customer_id, c.customer_name
FROM customers c
WHERE c.tenant_id = :tenant_id
  AND c.account_status = 'ACTIVE'
  AND EXISTS (
    SELECT 1
    FROM orders o
    WHERE o.tenant_id = c.tenant_id
      AND o.customer_id = c.customer_id
      AND o.status = 'PAID'
      AND o.paid_at >= :qualifying_start
      AND o.paid_at <  :qualifying_end
  )
  AND EXISTS (
    SELECT 1
    FROM customer_contact cc
    WHERE cc.tenant_id = c.tenant_id
      AND cc.customer_id = c.customer_id
      AND cc.verified_at IS NOT NULL
  )
  AND NOT EXISTS (
    SELECT 1
    FROM fraud_block fb
    WHERE fb.tenant_id = c.tenant_id
      AND fb.customer_id = c.customer_id
      AND fb.resolved_at IS NULL
  );

Each subquery has its own precise qualifier and repeats the trusted tenant relationship. Tests should isolate every fact: no paid order, an order outside the window, unverified contact, resolved block, unresolved block, and matching data in another tenant. This approach makes eligibility auditable and avoids relying on one large JOIN followed by DISTINCT.

Testing EXISTS

Test zero inner rows, one matching row, many matching rows, duplicate inner rows, inner rows that fail one qualifier, NULL correlation values, and unrelated rows. The outer result should appear once when at least one complete match exists.

For tenant security, include a matching relationship in another tenant and verify that it cannot authorize the outer row. Test every OR branch with mandatory scope.

Testing NOT EXISTS and All Logic

For NOT EXISTS, test no child rows, only qualifying children, at least one disqualifying child, and NULL in the violation column. For universal “all” logic, test the empty-child case explicitly and decide whether vacuous truth is acceptable.

If at least one child is required, verify both the positive EXISTS and negative violation predicates independently.

Performance Testing

Use realistic parent counts, child distributions, tenants, date ranges, and skew. Measure no-match, early-match, and many-match cases under concurrency. Compare alternatives only with equivalent semantics and representative indexes.

Do not benchmark EXISTS against a JOIN that returns duplicate relationship rows or against COUNT when the business requirement needs a count.

Common EXISTS Mistakes

  • Forgetting the correlation and returning all or no outer rows.
  • Correlating the wrong key or omitting tenant correlation.
  • Adding DISTINCT, GROUP BY, ORDER BY, or LIMIT without a real need.
  • Using COUNT when only existence matters.
  • Using JOIN plus DISTINCT to simulate eligibility.
  • Assuming EXISTS is always faster than IN or JOIN.
  • Assuming a correlated subquery physically runs once per row.
  • Writing NOT EXISTS without the qualifier whose absence matters.
  • Ignoring vacuous truth in “all children” rules.
  • Ignoring NULL in a violation predicate.
  • Using EXISTS when inner columns or exact counts are required.
  • Missing indexes or authorization scope on correlation keys.

Production Review Checklist

  1. State the exact related row whose existence matters.
  2. Verify every correlation key, including tenant or organization scope.
  3. Keep all qualifying inner conditions inside the subquery.
  4. Use JOIN when inner columns are required.
  5. Use NOT EXISTS for nullable anti-membership.
  6. Review NULL behavior in correlation and violation predicates.
  7. Decide whether empty child sets satisfy universal rules.
  8. Remove unnecessary DISTINCT, grouping, ordering, and counting.
  9. Index compatible correlation and selective filter columns.
  10. Keep authorization predicates server-controlled and correctly grouped.
  11. Use constraints and atomic mutations for concurrency-sensitive rules.
  12. Inspect actual plans and test realistic distributions.

Interview Questions and Answers

What does EXISTS do? It returns TRUE when its subquery returns at least one row.

Does the selected value matter? No; row existence matters, so SELECT 1 is conventional.

What is correlated EXISTS? Its subquery references columns from the current outer row.

EXISTS versus JOIN? EXISTS tests eligibility without returning or multiplying inner rows; JOIN retrieves relationship rows.

EXISTS versus IN? EXISTS expresses related-row existence; IN expresses value membership.

What is NOT EXISTS? An anti-existence test that is TRUE when no qualifying inner row exists.

Why prefer NOT EXISTS to NOT IN? NOT EXISTS avoids the nullable-set behavior that can make NOT IN UNKNOWN.

Does EXISTS create duplicates? No. Multiple inner matches still produce one TRUE result for the outer row.

What is a semi-join? Return outer rows with a match without returning inner columns.

What is an anti-join? Return outer rows with no qualifying match.

Can EXISTS use indexes? Yes; indexes on correlation and filter columns commonly support it.

Is correlated EXISTS always slow? No. Optimizers can transform it; measure the actual plan.

Key Takeaway

EXISTS is SQL's direct expression for related-row presence, while NOT EXISTS expresses absence. They model semi-joins, anti-joins, authorization, eligibility, and universal rules without multiplying outer rows.

RELIABLE EXISTS = CORRECT CORRELATION
                  + PRECISE INNER QUALIFIERS
                  + EXPLICIT TENANT SCOPE
                  + NULL-AWARE ANTI-LOGIC
                  + APPROPRIATE INDEXES
                  + ATOMIC CONCURRENCY RULES
                  + REPRESENTATIVE TESTS

Use EXISTS when only the fact of a match matters, JOIN when related data is needed, and COUNT when quantity rather than presence is the actual requirement.