# Prerequisite for Data examples

In order to make the usage examples of various Data blocks clear and easy to understand, we have created a common background or scenario, which we will explain in this section.

## Introduction Video

The following video serves as a great introduction to databases and also provides a general overview of data features in your Zingy app.

{% embed url="<https://youtu.be/3h_bRxORBlY>" %}
Video: Database Features
{% endembed %}

## Table Information

We will continue to use the example *Customers* [Database Table](https://docs.zingy.ai/app-editor/data/database-tables) presented in the above video and also detailed below:

<div align="left"><figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2FrxREPfJH9cX9sCo2q2G6%2Fimage.png?alt=media&#x26;token=f1479c4c-59e8-4361-ad8b-900ead127896" alt="" width="563"><figcaption><p>Example Database Table about Customers</p></figcaption></figure></div>

## Sample Records

We will use the following sample records for the *Customers* [Database Table](https://docs.zingy.ai/app-editor/data/database-tables).&#x20;

<figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2Fjm93DwEapBrb34khYmBj%2Fimage.png?alt=media&#x26;token=a105d625-968a-4af1-a609-ff25ff35248c" alt=""><figcaption><p>Example records for the Customers table</p></figcaption></figure>

## Sample Queries

The following [queries](https://docs.zingy.ai/app-editor/data/database-queries) are part of the *Customers* [Database Table](https://docs.zingy.ai/app-editor/data/database-tables).&#x20;

* NameMatch

  <figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2FF9ocB7nTqOqRbu8WQWzh%2Fimage.png?alt=media&#x26;token=0d2ac82d-7232-4afd-b783-bbdb6a4eed03" alt=""><figcaption></figcaption></figure>

  This query will list records where either the value of the *FirstName* *OR* the *LastName* fields, contains the text specified in the Input-1 parameter.&#x20;
* NamePhoneMatch

  <figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2FahHgHg0ofgPkd107Hug9%2Fimage.png?alt=media&#x26;token=c7c3c9e6-46e9-4c06-8034-35d4b2b3b0aa" alt=""><figcaption></figcaption></figure>

  This query will list records where the *PhoneNumber* field contains the text specified in the Input-2 parameter *AND* either of the *FirstName* or the *LastName* fields, contains the text specified in the Input-1 parameter.&#x20;

## Database Reading Logic for examples

For Page Flow/Cloud Flow blocks that are related to reading of database records, the following base logic is used:

* The [Data Read](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-read) block is used to read from the *Customers* [Database Table](https://docs.zingy.ai/app-editor/data/database-tables) with the dataset name of *ds1*.
* The [Data Status](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-status) block is then used to check the status.&#x20;
* In the *Success Tasks* [Flow Parameter](https://docs.zingy.ai/app-editor/block-anatomy#flow-parameters) of the [Data Status](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/data-status) block, the function *Usage Example* is invoked.
* All examples will be shown implementing the *Usage Example* function containing the specific block being explained.

<figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2F5lIQlTeB0M4dCINJ4Czd%2Fimage.png?alt=media&#x26;token=ca7636f7-7ecb-4aaf-bc0b-6b61cbd05c7e" alt=""><figcaption><p>Database reading logic for examples</p></figcaption></figure>
