Professional Documents
Culture Documents
Field Data Types
Field Data Types
Once you have identified the tables and the fields for your database, the next step is to determine each fields data type. With any relational database management system, you need to define what kind of information each field will contain. In most relational database management systems, there are three primary categories of field types: 1. Text 2. Numbers 3. Dates and Times Within each of these primary categories, there are variations of these categories, some of which may be specific to individual RDMSs. I will highlight particular differences as they arise. It is important to give careful thought and consideration to field types because they dictate what information can be stored and how it is stored which may affect database performance.
INT[Length] BIGINT[Length] FLOAT DOUBLE[Length, Decimals] DECIMAL[Length, Decimals] DATE DATETIME TIMESTAMP TIME ENUM SET
4 bytes 8 bytes 4 bytes 8 bytes Length +1 bytes or Length + 2 bytes 3 bytes 8 bytes 4 bytes 3 bytes 1 or 2 bytes 1, 2, 3, 4, or 8 bytes
Range of -2,147,483,648 to 2,147,483,647 or 0 to 4,294,967,295 unsigned Range of -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 or 0 to 18,446,744,073,709,551,615 unsigned A small number with a floating decimal point. A large number with a floating decimal point. A DOUBLE stored as a string, allowing for a fixed decimal point. In the format YYYY-MM-DD In the format YYYY-MM-DD HH:MM:SS. In the format YYYYMMDDHHMMSS; acceptable range ends in the year 2037. In the format of HH:MM:SS. Short for enumeration, that is, each column can have one of several possible values. Like ENUM except that each column can have more than one of several possible values.
6. Date/Time: a Date/Time field is used to store dates or times. A specific format to display dates and times can be selected. 7. Yes/No: a Yes/No field is the Access data type for recording one of two opposing values. Yes/No fields can be formatted as Yes/No, True/False, or On/Off (although all are equivalent). Every Yes/No field is formatted as a single check box; checked is Yes, True, or On whereas unchecked is No, False, or Off. 8. OLE Object: Object Linking and Embedding (OLE) Object data types enable you to embed or link to documents created in other programs, such as worksheets created in MS Excel, images (eg, gif, or jpg files), or word processing files (eg, doc files); one can either embed the object in the Access data file or link the object to the database, thereby storing a pointer or a reference to the original document. OLE is the technology which allows an object (such as a spreadsheet) to be embedded (and/or linked) inside of another document (like a word processor document). 9. Hyperlink: the Hyperlink data type enables you to store a clickable address in the field. For example: a. http:// b. mailto: c. ftp:// 10. Lookup Wizard: a Lookup Wizard field type enables a field to display a drop-down list of values from which the user can choose; this list of values can come from another table, a query, or event he same table.
Each binary digit (also called a bit for Binary digIT) can only take on one of two values, 1 or 0, instead of 0 to 9 like the decimal system. So the binary number 1100 would represent: (1*2^3) + (1*2^2) + (0*2^1) + (0*2^0) = 12 This time we use base of 2 instead of base of 10. A collection of 8 bits is known as one byte. With 8 bits in a byte, one can represent 256 values ranging from 0 to 255: 00000000 = (0*2^7) + (0*2^6) + (0*2^5) + (0*2^4) + (0*2^3) + (0*2^2) + (0*2^1) + (0*2^0) =0 11111111 = (1*2^7) + (1*2^6) + (1*2^5) + (1*2^4) + (1*2^3) + (1*2^2) + (1*2^1) + (1*2^0) = 255 Three bytes (24 bits) can then represent a number ranging from 0 to 16,777,215. 000000000000000000000000 = (0*2^23) + (0*2^22) + (0*2^21) + + (0*2^4) + (0*2^3) + (0*2^2) + (0*2^1) + (0*2^0) =0 111111111111111111111111 = (1*2^23) + (1*2^22) + (1*2^21) + + (1*2^4) + (1*2^3) + (1*2^2) + (1*2^1) + (1*2^0) = 16,777,215 Bytes are used to hold individual characters in a text document. For example, 00100000 is equal to 32 which is the numeric code for space. So text characters are coded as numbers which are stored as bytes in a computer file. The computer usually stores each character in 1 byte.