---
schema_version: "1"
id: 5d9d21d1505b4f22c1ef9e22bc33e9c88f4d94108ea4723e210cfe6730f5f286
title: Data Structures in AMPscript
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/ampscript/guide/mc-ampscript-guide-data-structures.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-data-structures.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: e1db249e5f2bbd0e848ead9a1f5469c8523076d69e71f8eab39aebfcee2d914f
products:
  - AMPscript for Marketing Cloud
  - Marketing Cloud
---
# Data Structures in AMPscript

There are two types of data structures that you interact with when using AMPscript: data extensions and rowsets. These structures are closely related.

## Data Extensions

At the most basic level, a data extension is a table that contains data. A data extension can stand alone or can be related to other data extensions. You can manually import data extensions into Marketing Cloud Engagement, or you can automate the import through Automation Studio or the Marketing Cloud Engagement API.

## Rowsets

A rowset contains one or more collections of data as rows. You can obtain rowsets by querying data extensions using AMPscript functions, such as `LookupRows()`. You can also create rowsets as needed (for example, by using the `BuildRowSetFromJSON()` function).

You can refer to an individual row in a rowset by using the `Row()` function. You can refer to an individual piece of data within a row by using the `Field()` function. AMPscript doesn’t allow you to output the contents of a rowset or row using functions such as `v()`.

To prevent errors and unexpected issues, we recommend that you check to see if a rowset contains data before processing it in a `For` loop. The most common way to perform this check is by using the `RowCount()` function to determine how many rows the rowset contains. You can use the row count in the condition statement in the `For` loop.

Alternatively, you can use the `Empty()` and `IsNull()` functions to determine if the rowset is empty. Both of these functions return `true` if the rowset doesn't contain any data.
