1 Востаннє редагувалося fed_lviv (23.09.2015 15:32:55)

Тема: Тип даних SQLite + SQLite Expert Personal

Вирішив "познать" SQLite, сильно наразі занурюватися не збираюсь, але ось відповідь на одне запитання хотів би знайти (отримати). До того мав справу тільки з Access та MySQL. Цікавить, думка людей, які мали справу з SQLite. Тип даних SQLite:

Each value stored in an SQLite database (or manipulated by the database engine) has one of the following storage classes:
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.

Тип boolean та date задаються:

1.1 Boolean Datatype
SQLite does not have a separate Boolean storage class. Instead, Boolean values are stored as integers 0 (false) and 1 (true).
1.2 Date and Time Datatype
SQLite does not have a storage class set aside for storing dates and/or times. Instead, the built-in Date And Time Functions of SQLite are capable of storing dates and times as TEXT, REAL, or INTEGER values:
TEXT as ISO8601 strings ("YYYY-MM-DD HH:MM:SS.SSS").
REAL as Julian day numbers, the number of days since noon in Greenwich on November 24, 4714 B.C. according to the proleptic Gregorian calendar.
INTEGER as Unix Time, the number of seconds since 1970-01-01 00:00:00 UTC.
Applications can chose to store dates and times in any of these formats and freely convert between formats using the built-in date and time functions.

А ось в SQLite Expert Personal можна вибирати тип даних BOOLEAN, DATETIME, ... Зробив по дві колонки (кожного типу) при запиті начебто різниці не має, але цікавить, як правильно робити? Як краще прописувати тип колонок?

Post's attachments

1.bmp 1.27 mb, 613 downloads since 2015-09-23