Показ дописів із міткою postgresql. Показати всі дописи
Показ дописів із міткою postgresql. Показати всі дописи

середа, 16 вересня 2009 р.

How to add 1 day to the date

MySQL : dateadd(dd, 1, getdate())
Oracle : SYSTIMESTAMP+NUMTODSINTERVAL(1,'day')
DB2 : CURRENT TIMESTAMP+1 DAY
PostgreSQL : LOCALTIMESTAMP+INTERVAL '1 day'

неділя, 30 серпня 2009 р.

Auto-increment field

How to create it in

a) MySQL:

CREATE TABLE `t1` ( `id` INT UNSIGNED AUTO_INCREMENT , ... ) AUTO_INCREMENT=... ;

b) PostgreSQL:
first create the sequence:

CREATE SEQUENCE "seq1" INCREMENT BY ... START WITH ... ;

and then - create the table:

CREATE TABLE "t1" ( "id" INT NOT NULL DEFAULT nextval('seq1') ...);

c) Microsoft SQL Server

CREATE TABLE [t1] ( [id] [int] NOT NULL identity(1, 2) ...);

(this means start with 1 and increment by 2 each time )

субота, 25 липня 2009 р.

ER tools for PostgreSQL

Indeed, PostgreSQL is a great database engine. It's free and open-source. Great tool for the server.

But what about developers? Which ER tools can we use for database design? I'm not talking about the databases with 5 tables, I mean more complex designs.

  • MySQL Workbench: a tool developed by Sun. It exports design into the MySQL-specific code, thus you have to modify it by hand in the text editor. Pros: you can show the graphic database design to the customer. Contras: MySQL-specific SQL and ... BUGGY !! (at least - the latest version. Just click the "Not NULL" checkbox in the fields list ... and the program dies).
  • Database Designer for PostgreSQL from MicroOLAP. Never used but look at the prices: starting from 124.95 USD for personal use. I think the tool is good, but the price...
Comparing to Microsoft SQL Server: you can buy the Developer edition where diagramming tool is surely pesent just for 60 bucks and be happy. This is a full-featured product which you cannot use in industry. Marvelous!

Any more ideas guys?