CREATE TABLE products( id integer NOT NULL, title character varying(255), description text, price numeric(10,2));
18.
CREATE TABLE users( id integer NOT NULL, first_name character varying(50), last_name character varying(50), email character varying(255), data hstore, created_at timestamp without time zone, updated_at timestamp without time zone, last_login timestamp with time zone);
データ型 Data typesINSERT INTO purchases VALUES ( 2, 2, '{{11.0, 1.0, 4.99}}', now());
21.
その他の言語 Other languadges bigint polygon moneytimestamp date booleaninterval tz smallint array integer UUID serial bytea char line numeric inet cidr point circle time text float macaddr timetz enum varchar tsquery XML path tsvector timestamp box
22.
その他の言語 Other languadgesCREATE OR REPLACE FUNCTION total(decimal(10,2)[][])RETURNS decimal(10,2) AS $$DECLARE s decimal(10,2) := 0; x decimal[];BEGIN FOREACH x SLICE 1 IN ARRAY $1 LOOP s := s + (x[2] * x[3]); END LOOP; RETURN s;END;$$ LANGUAGE plpgsql;
23.
その他の言語 Other languadgesFOREACH x SLICE 1 IN ARRAY $1 LOOP s := s + (x[2] * x[3]); END LOOP; RETURN s;
24.
その他の言語 Other languadgespython pgsql ruby j lolcode lua V8 R scheme tcl SQL psm Java sh php javascript
25.
エクステンション ExtentionCREATE EXTENSION hstore;CREATE TABLE users ( id integer NOT NULL, first_name character varying(50), last_name character varying(50), email character varying(255), data hstore, created_at timestamp without time zone, last_login timestamp without time zone);
26.
エクステンション ExtentionINSERT INTO usersVALUES ( 1, 'Craig', 'Kerstiens', 'craig.kerstiens@gmail.com', 'sex => "M", state => "CA"', now(), now());