yana Posted August 2, 2006 Share Posted August 2, 2006 Is there a similar way to create a database and table in PostgreSQL as is in MySQL???Any code sample would be great! Quote Link to comment https://forums.phpfreaks.com/topic/16333-how-to-create-a-database-and-table/ Share on other sites More sharing options...
jsmith67te Posted November 10, 2006 Share Posted November 10, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/16333-how-to-create-a-database-and-table/#findComment-122447 Share on other sites More sharing options...
neylitalo Posted November 14, 2006 Share Posted November 14, 2006 To create databases in postgres, you can use the createdb command:[code]postgres $ createdb --help[/code]for the syntax and options. Quote Link to comment https://forums.phpfreaks.com/topic/16333-how-to-create-a-database-and-table/#findComment-124322 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.