# Database

## Introduction

In Starcounter, classes are tables and class instances are rows. The database objects live in the database from the beginning. This means that they are not serialized to the database, they are *created* in the database from the time you use the new operator. SQL queries will immediately see them. There is no concept of moving data to and from the database. This means that accessing a property on a database object (e.g myPerson.FirstName) reads the value from the database rather than from the normal .NET heap. This is possible as the data of the database lives in the RAM.\
Read more in [Creating database classes](/2.3.2/guides/database/database-classes.md) and [Data manipulation](/2.3.2/guides/database/data-manipulation.md).

## Object Identity and Object References

Starcounter is a database that offers relational access, graph access, object oriented access and document access all rolled into one. We recommend using [object references](/2.3.2/guides/database/object-identity-and-object-references.md) (implicit keys) rather than primary keys and foreign keys (explicit keys) as object references.

## SQL

Each class marked with the `[Database]` attribute or inheriting a class marked with the `[Database]` attribute are available from [SQL queries](/2.3.2/guides/database/querying-with-sql.md). Object relational mapping  is not needed since classes and tables are the same in Starcounter.

## Relations

Using object references in your code instead of foreign keys, it is easier than ever to create [relations](/2.3.2/guides/database/relations.md) between objects.

## Inheritance

Starcounter allows any database object to [inherit from any other database object](/2.3.2/guides/database/inheritance.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.starcounter.io/2.3.2/guides/database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
