Datums- und Zeitdatentypen

Funktionen zur Datenbearbeitung in PostgreSQL

Brian Piccolo

Sr. Director, Digital Strategy

TIMESTAMP-Datentypen

  • ISO 8601-Format: JJJJ-MM-TT
    +------------------------------+
    | timestamp                    |
    |------------------------------|
    | 2019-03-26 01:05:17.93027+00 |
    +------------------------------+
    

----CODE_GLUE----


SELECT payment_date
FROM payment;

+---------------------+ | payment_date | |---------------------| | 2005-05-25 11:30:37 | +---------------------+
Funktionen zur Datenbearbeitung in PostgreSQL

Die Datentypen DATE und TIME

+------------+-------------------+
| date       | time              |
|------------|-------------------|
| 2005-05-28 | 01:05:17.93027+00 |
+------------+-------------------+

SELECT create_date FROM customer
+-------------+ | create_date | |-------------| | 2006-02-14 | +-------------+
Funktionen zur Datenbearbeitung in PostgreSQL

INTERVAL-Datentypen

+-----------+
| interval  |
|-----------|
| 4 days    |
+-----------+

SELECT rental_date + INTERVAL '3 days' as expected_return FROM rental;
+---------------------+ | expected_return | |---------------------| | 2005-05-27 22:53:30 | +---------------------+
Funktionen zur Datenbearbeitung in PostgreSQL

Datums- und Zeitformate im Detail

SELECT
    column_name, 
    data_type
FROM INFORMATION_SCHEMA.COLUMNS 
WHERE column_name in ('rental_date')
  AND table_name ='rental';

+-------------+-----------------------------+ | column_name | data_type | |-------------|-----------------------------| | rental_date | timestamp without time zone | +-------------+-----------------------------+
Funktionen zur Datenbearbeitung in PostgreSQL

Lass uns üben!

Funktionen zur Datenbearbeitung in PostgreSQL

Preparing Video For Download...