An integral part of most database tables is the “Counter” field. What is the feature of this column, what functions it performs and what properties it has, we will consider below. To do this, we dwell in more detail on the concepts of databases, their objects, and, in particular, tables, of which the counter is an element.
Database
Let's take a short excursion into the computer science of databases. A database is a set of tables with information between which there are connections. Databases are convenient for storing a large amount of data related to one topic. In business, they use databases for storing customer information: names, dates of birth, address, passport and other personal data.
Orders are recorded for each of the customers: the product and its quantity, dates, delivery method, and other features. Information about the goods themselves is also contained in the storage facilities and represents a complete set of parameters characterizing the products for sale.
Banks store information on customers, deposits and loans in their databases . It also contains financial parameters that allow you to generate reports for business analysis and provision to regulatory authorities.
A travel company works with a database that stores data on business partners, tourists, hotels and excursions. Using special applications, tariffs and cost of tours are calculated.
Thus, the data contained in the database corresponds to the industry in which the company operates.
DB Objects
The main database object is a table, the main database information storage. These are the tables that we used to see in the classroom at school or university, in books and textbooks. They consist of rows, which in databases are called records or tuples, and columns bearing the name of the fields.
Forms contain the same values as the tables, but in the form that is more suitable for users. In the interface, forms are used to process table entries: adding new ones, changing existing ones, removing unnecessary ones. Contain the fields of one or several tables, all columns or only some.
Requests do the bulk of the interaction of interface forms with other database objects, their elements, and the database itself. When you simply click the “Delete row” button on the database application form, it is the query that completes the action and fulfills your requirement.
Reports are used to output information to the printer, and macros and modules are provided for executing procedures in response to events in the database application interface.
Features of database tables
As we know from the computer science course, databases consist of tables. Each row contains data related to one object. We give an example. The database of the travel agency contains a table “Hotels”, each entry of which contains full information on one of the hotels: name, category, address, link to the website, phone and fax numbers, etc.
Each of the columns determines which values are in it. From the same example of hotels it can be seen that one of the fields is called “Name”, and it contains only the names of hotels. Another field is a category, it records how many stars this hotel has. Thus, going through the entire column, we see the values of one parameter of each row.
Database fields are of various types: text, numeric, monetary, logical, in the format of date and time. This defines the constraints that are imposed on the values in these columns. Having determined the type of the “Date and Time” field, we will no longer be able to enter the last name or first name in it, the input of alphabetic characters is prohibited in the numeric field, and the value cannot be entered in the logical column.
The “Counter” field type stands apart. What is the feature of its use, consider below.
Counter Type Field
We turn again to our table of hotels. In the first column, which is called "Code", we see numbers - serial numbers of each of the hotels. They are not repeated and designate the record in such a way that we know exactly what number the hotel contains in the table. This makes it easy to find the right hotel by this code.
The "Code" field has the type of the "Counter" field. What is the feature of this field based on the information above? First of all, this is the uniqueness of the column values. This property provides uniqueness of record identification. There cannot be two records in the table with the same value of the “Code” parameter. The uniqueness of the field values allows you to use it as a primary key, that is, a column referenced by fields of other tables.
Another ability of the counter is auto-increment - the property of automatically increasing the number. Thanks to her, the user does not need to think about what number to enter for the next record. The system itself will increase the number of the previous one and assign this number to a new one.
Example
In our experimental database Access table "Hotels" has been added. The counter field is called “Code”, the numbering starts from one.
The second database table - "Regions" - also contains a counter field. What is the feature of the table of regions? The fact that her records are used by the hotel table to specify the location of the hotel. Here the value is selected from the drop-down list:
And by region, we can see the hotels located there:
Thus, the counter field is a significant element of database tables that allows you to uniquely identify a record, automatically assign it a unique number and then use this number when referring to rows of an object from another table.