Data Types |
Data type is a group that has certain types. In other words, data type is a method used to determine the type of data, another word for this is "variable declaration". In programming languages have many types of data types that can be used. But every programming language has data types that might not exist in other programming languages. But in general, in any programming language recognize these 5 data types, namely integer, float, char, string, and boolean. Each of these data types has their respective uses. Therefore, if during data processing there are data that have different data types, then conversion must be done first. Following are explanations of the four data types.
Integer, this integer data type is used to declare data / variables as integers. For example, values 10, 7,29,100, and 22. The use of integer data types is usually used for data that will be operated by addition, subtraction, division, or multiplication.
Float, like integers, this data type is used for numeric data, but for numbers / values in the form of fractions. So if you want to get the best results in a number operation process, then you can use the float data type. For example the values of 1.5, 3.5, 3.14, and other other fractions.
Char, char is the data type used for variable declarations in the form of characters. These characters can be symbols, alphabet, or numbers.
Strings, specifically for strings, the data type used to declare data that contains sentences or words. Boolean, this data type is very different from the others. Because this boolean data type is only used for data that has 2 values only, namely true or false.
Types of Data Types
A.Primitive Data Types (Simplified)
Primitive data types are basic data types that can only store one type of value in one variable.
Primitive data types are basic data types that can only store one type of value in one variable.
This data type is often used by programmers because it is easy to use and is the same as other
programming languages.Some examples of primitive data types that are often encountered are
numeric types (integer, real / float), characters (char), rows of characters (strings) and booleans
(True or False).
B.Numeric Data Type
Numeric Data Types are numeric data types, which are divided into integer and real / float data types:
1. Integer
Integers are data types in the form of integers. The range is as follows:
| Data Type | Size | Place Value Range
Bytes 1 byte 0 to +255
Shortint 1 byte -28 to +127
Integer 2 bytes -32768 to 32767
Word 2 bytes 0 to 65535
Longint 4 bytes 2147483648 to 2147483647
2. Real / Float
Real / Float are fractions or numbers.
| Data Type | Size | Place Value Range
Real 6 bytes 2.9 x 10-39 to 1.7 x1038
Single 4 bytes 1.5 x 1045 to 3.4 x 1038
Double 8 bytes 5.0 x 10-324 to 1.7 x 10308
Extended 10 bytes 3.4 x 10-4932 to 1.1 x 104932
Comp 8 bytes -9.2x 1018 to 9.2x 1018
3.Character Data Type (Char)
Char Is a data type that only stores one digit number or letter.
Examples of uses are:
=> Character letters: ‘a’ .. ’z’, ’A’ .. ’Z’
=> Number characters: ‘0’ .. ’9’
4.String Data Type
String is a data type in the form of a row of characters both numbers, letters and symbols.
Example string:
=>"P3rk3n4lk4n, N4m4 $ 4y4 R @ n66 @ _ $ @ reza @."
5.Boolean Data Type
Boolean is a logical data type, which only recognizes two values 1 or 0, True or False, Dark or Light, True or False. In its use, Boolean only uses the least memory.
C. Composite Data Type
Composite is a data type that can store many values with different types. Examples are as follows:
*Array
Array or array is a structured data type that is able to store a lot of data but with the same type (homogeneous). Here is an illustration of the Array of friends on campus:
-Manarul
-Rizky
-Aditya
-Furqon
Record or struct
Records are known in Pascal while Struct is in C ++. Records are almost the same as arrays, but the difference is that this data type can store a lot of data with different types (heterogeneous). The following illustration illustrates the name and class of friends on campus:
=>Manarul 4 B
=>Rizky 2 A
=>Aditya 4 C
=>Furqon 2 A
D.BLOB
BLOB is a data type that stores binary numbers. So in principle, images that are normally stored on a computer actually have binary values and can then be accommodated in this data type. Not only images, music files, videos, documents and others can also be stored in the BLOB data type.
Date Time
Date Time is a type of data that stores date (time), time (time) or date time (date and time) with a specific format, Example:
Date: 2017-March-24
Time: 20:51
Date Time: 2017-03-24 20:51
The object
Object is a data type that stores the values of objects provided by GUI-based programming such as Visual Basic, Delphi and others.
Example:
Object: Commond Button
Name: cmdsave
Value accommodated: Save Data
Enumeration
Enumeration is a data type that has elements in certain order and range. Each element is represented by a number in its order (index), then each index contains a value written in parentheses.
As an example :
Data type: day_in_week
Index: 0,1,2,3,4,5,6
Value: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
The following illustrations are: (0) Monday, (1) Tuesday, ... (6) Sunday
Some of Teknoborneo's experiences in using a number of programming languages such as (C, C ++, Visual Basic, Delphi, Java, PHP) as well as databases such as (Microsoft Access, MySQL, SQL Server, Oracle) turned out to be different types of data loaded both in name and amount. The more new programming languages or databases are used, the more types of data types are also available.
As an example :
In Microsoft Access the mention of the String data type is Sort Text / Long Text while in MySQL it is Varchar.
In Access 2016 there are 12 known data types, while in MySQL there are 39.
Thank's for this information
ReplyDeleteAmazing bro, and now I know
ReplyDeleteNice!
ReplyDelete