computer-ersthelfer.de

...Webtools von mir, fuer euch...

Datentypen

Datentyp Größe Wertebereich Operatoren MSSQL MySQL C# Java Python PHP
int / INTEGER 4 Byte -2.147.483.648 bis 2.147.483.647 + - * / % ++ --
bigint 8 Byte -9.223.372.036.854.775.808 bis 9.223.372.036.854.775.807 + - * / % ++ -- ✔ (long) ✔ (long) ✔ (int) ✔ (int)
money 8 Byte -922.337.203.685.477,5808 bis 922.337.203.685.477,5807 + - * / % decimal BigDecimal decimal.Decimal float
smallmoney 4 Byte -214.748,3648 bis 214.748,3647 + - * / % decimal BigDecimal decimal.Decimal float
real 4 Byte Präzision ca. 7 Stellen + - * / % float float float float
smalldatetime 4 Byte 01.01.1900 bis 06.06.2079 (minuten-genau) =, !=, <, >, BETWEEN DateTime LocalDateTime datetime DateTime
text max. 2^31-1 Zeichen Text (bis 2.147.483.647 Zeichen) =, !=, LIKE, + (Concat) longtext string String str string
nchar 2*n Byte Unicode, max. 4000 Zeichen =, !=, LIKE nchar string String str string
nvarchar 2*n Byte Unicode, max. 4000 Zeichen =, !=, LIKE nvarchar string String str string
ntext max. 2^30-1 Zeichen Unicode-Text (bis 1.073.741.823 Zeichen) =, !=, LIKE, + (Concat) longtext string String str string
binary n+4 Byte Binärdaten, max. 8000 Byte =, != binary byte[] byte[] bytes string (binär)
varbinary n+4 Byte Binärdaten, max. 8000 Byte =, != varbinary byte[] byte[] bytes string (binär)
image max. 2^31-1 Byte Binärdaten, max. 2.147.483.647 Byte =, != longblob byte[] byte[] bytes string (binär)
cursor - Referenz auf Cursor - - - - -
sql_variant bis 8016 Byte Wert eines anderen Typs - object Object object mixed
table - Tabellenvariable - - - - -
timestamp 8+4 Byte Automatisch generierte Binärzahl, eindeutig - byte[] byte[] bytes string (binär)
uniqueidentifier 16 Byte GUID (z.B. 6F9619FF-8B86-D011-B42D-00C04FC964FF) =, != char(36) Guid UUID uuid.UUID string
smallint 2 Byte -32.768 bis 32.767 + - * / % ++ --
tinyint 1 Byte 0 bis 255 (unsigned) + - * / % ++ -- ✔ (byte) ✔ (byte) ✔ (int) ✔ (int)
float 4 Byte ±1.5×10−45 bis ±3.4×1038 + - * / % ++ -- ✔ (float)
double 8 Byte ±5.0×10−324 bis ±1.7×10308 + - * / % ++ --
decimal / numeric 16+ Byte ±1038 (präzise Nachkommastellen) + - * / % ++ -- ✔ (decimal) ✔ (BigDecimal) ✔ (decimal.Decimal) ✔ (float)
char 1 Byte 1 Zeichen =, !=, <, >, LIKE ✔ (str, len=1) ✔ (string, len=1)
varchar / string max. 231 Zeichen Text =, !=, <, >, LIKE, + (Concat) ✔ (string) ✔ (String) ✔ (str) ✔ (string)
date 3-8 Byte 1000-01-01 bis 9999-12-31 =, !=, <, >, BETWEEN ✔ (DateTime) ✔ (LocalDate) ✔ (datetime.date) ✔ (DateTime)
datetime / timestamp 8 Byte 1000-01-01 00:00:00 bis 9999-12-31 23:59:59 =, !=, <, >, BETWEEN ✔ (DateTime) ✔ (LocalDateTime) ✔ (datetime) ✔ (DateTime)
boolean / bit 1 Bit / 1 Byte 0, 1 / true, false AND, OR, NOT, =, != ✔ (bool) ✔ (boolean) ✔ (bool) ✔ (bool)

Legende: ✔ = Datentyp vorhanden/äquivalent
Die Angaben zu Größe und Bereich können je nach System/Implementierung leicht variieren.
Operatoren: Die wichtigsten Standardoperatoren für den jeweiligen Typ.
Programme: MSSQL = Microsoft SQL Server, MySQL = MySQL/MariaDB, C# = .NET, Java, Python, PHP.
Weitere Typen (z.B. ENUM, BLOB, ARRAY, JSON) sind je nach System verfügbar.