Jump to content

How to create a database and table?


yana

Recommended Posts

  • 3 months later...
Dunno if this one's been answered .. how long has it been around?  Anyway, I did this in an *.sql file..

[i]CREATE SEQUENCE user_ids
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;

--
-- Table "users"
-- Name: users; Type: TABLE; Schema: public; Owner: cdi
--

CREATE TABLE users (
    user_id integer DEFAULT nextval('user_ids'::text) PRIMARY KEY,
    username character varying(128) DEFAULT ''::character varying NOT NULL,
    mail_host character varying(128) DEFAULT ''::character varying NOT NULL,
    alias character varying(128) DEFAULT ''::character varying NOT NULL,
    created timestamp with time zone DEFAULT now() NOT NULL,
    last_login timestamp with time zone DEFAULT now() NOT NULL,
    "language" character varying(5) DEFAULT 'fr'::character varying NOT NULL,
    preferences text DEFAULT ''::text NOT NULL
);[/i]
.. etc. 

I then connect to the database and do ..

[i]\i <path_to_*.sql_file>[/i]

HTH.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.