Archiv verlassen und diese Seite im Standarddesign anzeigen : Übersicht über SQL-Datentypen.
Grüssi!
Ich arbeite mich gerade etwas genauer in SQL ein, und dabei stellt für mich die große anzahl von datentypen doch eine Hürde dar.
Warum gibt es z.b. tinyint, int und integer, wenn ich sowieso die maximale Stellenanzahl z.B. tinyint(3) angeben muss?
Kennt wer eine gute Übersicht, mit einer Tabelle die die Wertebereiche etc. angiebt?
Danke schonmal,
Hi,
ich weiß nicht ob Dir das hilft, aber hast Du schon mal in der Doku zu einer bestimmten SQL DB nachgeschaut, z.B. sind die Datentypen von mySQL hier beschrieben: http://www.mysql.com/doc/en/Column_types.html
Bzw. spezifisch für Zahlen mit ihrer Datenbreite hier: http://www.mysql.com/doc/en/Numeric_types.html
Wobei ich jetzt nicht sagen kann, ob das allgemein gültig ist oder spezifisch für die jeweilige DB, wie in diesem Fall mySQL.
Gruß
Pingu
Christoph
04-11-2003, 08:10
Wenn's Dir um Standard-Kompatibilität geht, dann empfehle ich folgendes Buch:
Date, Darwen: "SQL - Der Standard", Addison-Wesley
Ansonsten ist die mySQL-Doku vielleicht nicht die richtige Informationsquelle, weil mySQL doch ziemlich vom SQL-Standard abweicht. Selbst bei PostgreSQL, das sich fast sklavisch an den SQL-Standard hält, gibt es spezifische Erweiterungen, die nur bei PostgreSQL existieren. Immerhin wiest das SQL-Handbuch von PostgreSQL deutlich auf die Kompatibilität der einzelnen Kommandos hin.
Danke für eure Hilfe!
Nur noch eine Frage: Was bedeutet die Klammer bei einem Dtentyp: z.B. (balbal int(3)) kann man damit einfach die maximale Stellenanzahl (sinnlos) begrenzen?
Martin Ament
08-11-2003, 20:17
The NUMERIC and DECIMAL types are implemented as the same type by MySQL, as permitted by the SQL-92 standard. They are used for values for which it is important to preserve exact precision, for example with monetary data. When declaring a column of one of these types the precision and scale can be (and usually is) specified; for example:
salary DECIMAL(5,2)
In this example, 5 (precision) represents the number of significant decimal digits that will be stored for values, and 2 (scale) represents the number of digits that will be stored following the decimal point. In this case, therefore, the range of values that can be stored in the salary column is from -99.99 to 99.99. (MySQL can actually store numbers up to 999.99 in this column because it doesn't have to store the sign for positive numbers)
--
Ich kann mich allerdings nur meinem Vorgänger anschliessen:
http://www.mysql.com/doc/en/Numeric_types.html
Powered by vBulletin® Version 4.2.5 Copyright ©2025 Adduco Digital e.K. und vBulletin Solutions, Inc. Alle Rechte vorbehalten.