Tables overview
Tables are the fundamental objects in any database. They're the objects in which you store and manipulate data. This is true no matter what kind of data you need to manage. When you create a new database, you begin by building the tables. Later, you create pages and reports in order to access and view the data in the tables.
A table can be visualized as a two-dimensional matrix, consisting of columns and rows. In a table each row is a record and each column is a field. A table consists of two parts: the table data and a table description. The table data is the part users often think of as comprising the database, because it contains the actual records with their data fields. The layout and properties of those fields, however, are specified by the table description. The table description isn't directly visible to the user. The following illustration shows how the table data and the table description together form a table.
When you design a table, you assign many characteristics to it, such as a name, an ID number, and the fields it contains. You also assign many characteristics (such as name, ID number, data type, and initial value) to each field. When you design a new table, you also specify which keys you want the system to maintain. All these characteristics are stored in the table description when you save your table design.
The information in the table description is used by SQL Server and occasionally by database users who need information about the table structure. The table description makes the database flexible, as it lets the system access tables with different structures. The database can extract the definitions of the table structure from the table description and thereby correctly access any table.
The following illustration shows that a table description contains properties, triggers, fields, and keys and shows how these are related.
The table description contains some properties that are related to the table, others that are related to the fields in the table, and other properties related to keys. You can also see that triggers are defined both for the table and for the fields in the table.
Creating tables
In AL code, you can create new tables or modify existing tables. Read more about creating and modifying tables in the following sections.
To | See |
---|---|
Create a new table object | Table object |
Modify an existing table object | Table extension object |
Decide which field data type you want to apply to your data | Field data types |
Apply table and field properties | Table and table extension properties |
Set primary and secondary table keys | Table keys |
Using triggers in database design
Dynamics 365 Business Central supports setting up actions to take place in response to specific events. These are known as triggers. The following articles help to explain how Dynamics 365 Business Central implements this feature of database design.
To | See |
---|---|
Learn about the set of triggers that Dynamics 365 Business Central supports for tables and fields. |
Creating relationships between tables
In Dynamics 365 Business Central, the primary way to establish a connection between tables is to use the TableRelation property. The following articles go into detail about how this works.
To | See |
---|---|
Get a brief introduction to relational database design in Dynamics 365 Business Central. | Setting relationships between tables |