# Lesson 7: Understanding query patterns

In this lesson, we’ll learn advanced aspects of building query patterns. We’ll begin by examining how TypeDB resolves patterns against the schema as **constraint satisfaction** problems. We’ll then examine some specific syntax elements we can use in patterns, including **advanced relation patterns**, **logical operators**, **value comparisons**, and **value expressions**. Finally, we’ll study the semantics of **solution sets**, to understand how the number of times a pattern is matched can affect the results of read and write queries.

## [](#_recommended_prerequisites)Recommended prerequisites

*   You should complete [Lesson 5](../5-defining-schemas/index.md) before starting this lesson.
    

## [](#_lesson_contents)Lesson contents

[Lesson 7.1: Patterns as constraints](7.1-patterns-as-constraints/index.md)

Learn how patterns are treated as constraint satisfaction problems.

[Lesson 7.2: Relation patterns](7.2-relation-patterns/index.md)

Learn how to construct different representations of relations.

[Lesson 7.3: Logical operators](7.3-logical-operators/index.md)

Learn how to use disjunctions, negations, optionals, and identities.

[Lesson 7.4: Value comparisons](7.4-value-comparisons/index.md)

Learn how to compare the values of different attributes.

[Lesson 7.5: Value expressions](7.5-value-expressions/index.md)

Learn how to create and use computed variables.

[Lesson 7.6: Solution set semantics](7.6-solution-set-semantics/index.md)

Learn about how different patterns affect the number of results.

## [](#_typeql_keywords_introduced)TypeQL keywords introduced

*   `or`
    
*   `not`
    
*   `try`
    
*   `is`
    
*   `like`
    
*   `contains`
    
*   `min`
    
*   `max`
    
*   `round`
    
*   `floor`
    
*   `ceil`
    
*   `abs`
    

[Summary](../6-building-applications/summary/index.md) [Patterns as constraints](7.1-patterns-as-constraints/index.md)

[Edit on GitHub](https://github.com/typedb/typedb-docs/edit/3.x-development/academy/modules/ROOT/pages/7-understanding-query-patterns/index.adoc) Edit this page on GitHub.