LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-15-2005, 01:05 AM   #1
kranti
LQ Newbie
 
Registered: Oct 2005
Location: Pune
Posts: 17

Rep: Reputation: 0
create table in postgres database


Hi,

I want to create a table in postgres database with following format...

table name: emp_info

columns

id
name
address
email
phoneno

indexes:

"emp_info_id_key" unique, btree (id, address)
"emp_info_name_key" unique, btree(name, address)

Theoretically, it is not possible to create multiple primary keys for a table. Hence I'm not able to create this type of table. Is any thing other than primary key is required to create such a table?

Thanks in advance,
Kranti
 
Old 11-15-2005, 06:52 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,697

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
True that you can only have on primary key but you can create multiple indexes. I do not think your emp_info_name_key index can be defined as unique. However, I do not claim to be a database expert and I am not sure on what you are trying to accomplish so have a go here:
http://www.postgresql.org/docs/8.1/i...e/indexes.html
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Postgres Database Connection anjani.78 Linux - Software 1 10-07-2005 02:06 AM
changing password for postgres database anjani.78 Linux - Software 1 07-18-2005 10:58 PM
Displaying the table definition on Postgres mkrishnanand Programming 1 08-18-2004 03:51 PM
How to empty database table?? edhan Linux - General 2 10-24-2003 08:53 PM
Connecting a Postgres Database from a Java application Paulo Góes Programming 4 08-23-2003 10:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration