# Lesson 3: Reading data

In this lesson, we’ll learn how to read pre-inserted data in the sample database using **Fetch queries**. We’ll begin by seeing how we can retrieve **entities** and **relations** in a similar way to how we do with relational databases. We’ll then see how we can retrieve data in unique ways using TypeDB: by writing declarative **polymorphic** queries, by leveraging **functions**, and by retrieving **types** from the schema. Finally, we’ll look at a few examples of **type inference** at work by seeing how TypeDB validates queries.

## [](#_recommended_prerequisites)Recommended prerequisites

*   You should complete [Lesson 2](../2-environment-setup/index.md) before starting this lesson.
    

## [](#_lesson_contents)Lesson contents

[Lesson 3.1: Fetching simple data](3.1-fetching-simple-data/index.md)

Learn how to retrieve the attributes of entities and relations.

[Lesson 3.2: Fetching polymorphic data](3.2-fetching-polymorphic-data/index.md)

Learn how to retrieve data with polymorphic queries.

[Lesson 3.3: Using functions](3.3-using-functions/index.md)

Learn how to invoke functions for modularization and recursion.

[Lesson 3.4: Fetching schema types](3.4-fetching-schema-types/index.md)

Learn how to retrieve typing information from the schema.

[Lesson 3.5: Query validation](3.5-query-validation/index.md)

Learn about how queries are validated against the schema.

## [](#_typeql_keywords_introduced)TypeQL keywords introduced

*   `match`
    
*   `fetch`
    
*   `attribute`
    
*   `isa`
    
*   `has`
    
*   `entity`
    
*   `relation`
    
*   `isa!`
    
*   `sub`
    
*   `sub!`
    
*   `owns`
    
*   `relates`
    
*   `plays`
    

[Sample deployment](../2-environment-setup/2.1-sample-deployment/index.md) [Fetching simple data](3.1-fetching-simple-data/index.md)

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