Presentation is loading. Please wait.

Presentation is loading. Please wait.

TIPI PODATKOV. Načrt Najprej je potrebno dobro premisliti o problemu Katere podatke hranimo, kako podatke razporediti v tabele, kakšne vrste podatkov.

Similar presentations


Presentation on theme: "TIPI PODATKOV. Načrt Najprej je potrebno dobro premisliti o problemu Katere podatke hranimo, kako podatke razporediti v tabele, kakšne vrste podatkov."— Presentation transcript:

1 TIPI PODATKOV

2 Načrt Najprej je potrebno dobro premisliti o problemu Katere podatke hranimo, kako podatke razporediti v tabele, kakšne vrste podatkov so,

3 Tipi podatkov Žal vsak RDBMS počne to po svoje Razlog: koliko prostora porabiti za podatek Približno "standardni" tipi: – char oz. varchar za znake – integer – float (ali double) Pri delu s programi: – Preslikava med tipi v bazi in tipi v programskem jeziku

4 char, varchar in varchar2 char – Fiksna velikost prostora – Kadar se podatki ne bodo spreminjali glede dolžine – Učinkovita izraba prostora (če so nizi res dolgi, kot je deklarirano), hitrost, ampak teževe, če bi imeli daljši podatek varchar – Porabljeni prostor se prilagaja dejanski dolžini – Načeloma počasneje, a bolj fleksibilno kar se prostora tiče varchar2 – Vpelje Oracle – V tem trenutku ni bistvene razlike, v prihodnosti verjetno da – Načeloma priporočajo uporabo varchar2

5 Tipi Data TypeSyntaxExplanation (if applicable) integer smallint numericnumeric(p,s) Where p is a precision value; s is a scale value. For example, numeric(6,2) is a number that has 4 digits before the decimal and 2 digits after the decimal. decimaldecimal(p,s)Where p is a precision value; s is a scale value. real Single-precision floating point number double precision Double-precision floating point number floatfloat(p)Where p is a precision value. characterchar(x) Where x is the number of characters to store. This data type is space padded to fill the number of characters specified. character varyingvarchar2(x) Where x is the number of characters to store. This data type does NOT space pad. bitbit(x)Where x is the number of bits to store. bit varyingbit varying(x) Where x is the number of bits to store. The length can vary up to x.

6 Tipi nad. Data TypeSyntaxExplanation (if applicable) date Stores year, month, and day values. time Stores the hour, minute, and second values. datetime Stores year, month, day, hour, minute, and second values. timestamp Stores unique year, month, day, hour, minute, and second values. time with time zone Exactly the same as time, but also stores an offset from UTC of the time specified. timestamp with time zone Exactly the same as timestamp, but also stores an offset from UTC of the time specified. year-month interval Contains a year value, a month value, or both. day-time interval Contains a day value, an hour value, a minute value, and/or a second value.

7 MS SQL Ime jezika: Transact-SQL Točno računanje – int, bigint, numeric, money … Premična vejica – float, real Binarni nizi – binary, image Znakovni nizi – char, varchar, text Znakovni nizi v Unicode – nchar, nvarchar, text Datum in čas – date, time, datetime … Ostali – xml, timestamp … Glej: http://msdn.microsoft.com/en-us/library/ms187752.aspxhttp://msdn.microsoft.com/en-us/library/ms187752.aspx

8 SQLite 3 NULL. The value is a NULL value. INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value. REAL. The value is a floating point value, stored as an 8-byte IEEE floating point number. TEXT. The value is a text string, stored using the database encoding (UTF-8, UTF-16BE or UTF- 16LE). BLOB. The value is a blob of data, stored exactly as it was input.

9 Druge baze PostgreSQL: – http://www.postgresql.org/docs/8.1/static/datatype.h tml http://www.postgresql.org/docs/8.1/static/datatype.h tml SQLLIte (Python): – http://www.sqlite.org/datatype3.html http://www.sqlite.org/datatype3.html MySQL: – http://dev.mysql.com/doc/refman/5.1/en/data- types.html http://dev.mysql.com/doc/refman/5.1/en/data- types.html Pogosto RDBMS omogoča tvorbo vzdevkov (ALIAS) za druga imena


Download ppt "TIPI PODATKOV. Načrt Najprej je potrebno dobro premisliti o problemu Katere podatke hranimo, kako podatke razporediti v tabele, kakšne vrste podatkov."

Similar presentations


Ads by Google