您在這裡

Records

19 一月, 2016 - 14:28

Just as the content of any one document or item needs to be broken down into its constituent bits of data for storage in the fields, the link between them also needs to be available so that they can be re-constituted into their whole form. Records allow us to do this. A tuple is another term used for records.

A simple table gives us the clearest picture of how records and fields work together in the database storage project. Records and fields form the basis of all databases.

media/image3.png
Figure 7.2
 

The example above shows us how fields can hold a range of different sorts of data – this one has:

  • An ID field: ordinal number. integer
  • A Pubdate field: day/month/year. date
  • An author field: Initial. Surname. text
  • A title field: text. •
  • A body text field: text.

By creating fields especially for the sorts of data they will house, the database can sort them intelligently. You can request a selection of records which are limited by their date – all before a given date, or all after a given date or all between 2 given dates. Similarly you can choose to have records sorted by date. What is happening here is that the database is reading the information in the date field, not just as numbers separated by slashes, but rather as dates which must be ordered according to a calendar system – because the field was set up as a date field. You are commanding the database to sift through its data and organise it in a particular way.