- phpMyAdminStarter (Microcontent)
- Gordon Du
- 374字
- 2021-04-02 19:18:26
Table links—the key for the right query
Table links are fundamental for query building. You will see some different links in this section, but the most common links will be discussed in the next section because there are too many and they are used too often.
To understand table links, you need to know more about table structures.
Primary key
Every table has a primary key. Some of the tables have foreign keys too. All those keys are used for the index. Docentry is a typical primary key to link OXXX with XXXn document tables. For example, Docentry is a common key field to link OPOR with POR1, POR2 to POR12.
A primary key can be one or more fields. For a simple table one key field would be good enough. For a complicated table, two or more fields for primary key are not rare.
A primary key has to be unique within the same table. This key will not allow NULL
value—that is, an empty field or a field with no data.
Foreign key
A foreign key is usually used to link to some other table's primary key. This field will be updated whenever the other table record has changed.
Although, you could link any fields between tables, if the field is not NULL
, you should try to use key link wherever possible in order to increase the database performance.
Example of table links within SAP Business One
To be clearer about the link, here are a few table link examples:
- OITM-Items table and ITM1-Items Prices table:
These two tables are linked through ItemCode field. Both tables have the same field name to link. It is not one-to-one but one-to-many relationships. One Item Code in item master may have more than one item price associated.
- OITT-Product Tree table and ITT1-Product Tree Child Items:
These two tables are linked through Code field in OITT and Father field in ITT1. These tables are used for Bill of Materials.
- OCRD-Business Partner table and OSLP-Sales Employee table:
These two tables are linked through the same name field SlpCode. In the second table, SlpCode is the primary key for OSLP. On the other hand, it is a foreign key in the first table OCRD.
- Cinema 4D 2024+AI工具詳解與實戰(zhàn)(視頻微課·全彩版)
- Maya建模技術(shù)解析
- Photoshop CS6中文版基礎(chǔ)培訓(xùn)教程
- 數(shù)碼攝影后期處理秘笈:Photoshop CC專業(yè)調(diào)色(第2版)
- Photoshop+Adobe Camera Raw+Lightroom(攝影后期照片潤飾實戰(zhàn))
- 零基礎(chǔ)學(xué)數(shù)碼攝影后期
- ASP.NET jQuery Cookbook
- 中文版Photoshop CC平面設(shè)計從入門到精通(唯美)
- Java EE 6 with GlassFish 3 Application Server
- 新印象:CINEMA 4D電商設(shè)計基礎(chǔ)與實戰(zhàn)(全視頻微課版)
- Oracle Fusion Middleware Patterns
- Oracle Warehouse Builder 11g R2: Getting Started 2011
- Getting Started with Oracle BPM Suite 11gR1 – A Hands/On Tutorial
- 社會調(diào)查數(shù)據(jù)管理:基于Stata 14管理CGSS數(shù)據(jù)
- 邊做邊學(xué):CorelDRAW X6圖形設(shè)計案例教程(第2版)(微課版)