Обсуждение: Primary & Foreign Keys in pgAdmin

Поиск
Список
Период
Сортировка

Primary & Foreign Keys in pgAdmin

От
MrTeeth
Дата:
I was wondering can some give me an explanation on how to assign primary and
foreign keys in pgAdmin?

I can't find any information online.

For example...I've got a Student table with all their details (address,
d.o.b. and etc.). I'm going to add a student_number to the table and make it
a primary key.

I just want to know how do I do that using pgAdmin? And if you may be kind
to explain give me further information on using Primary Keys in postgreSQL
(and pgAdmin). The same case with the foreign keys.

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Primary-Foreign-Keys-in-pgAdmin-tp5569384p5569384.html
Sent from the PostgreSQL - pgadmin support mailing list archive at Nabble.com.


Re: Primary & Foreign Keys in pgAdmin

От
Raymond O'Donnell
Дата:
On 15/03/2012 21:50, MrTeeth wrote:
> I was wondering can some give me an explanation on how to assign primary and
> foreign keys in pgAdmin?
> 
> I can't find any information online.
> 
> For example...I've got a Student table with all their details (address,
> d.o.b. and etc.). I'm going to add a student_number to the table and make it
> a primary key.

In the tree view on the left, right-click on the table and select "New
object", then "New primary key".

If the table already has a primary key, you can drop it and make your
new student number the PK instead. Click the "+" to see the table
attributes; under "constraints", select the PK, right-click and select
"Delete/drop". Add the new PK as above.

> 
> I just want to know how do I do that using pgAdmin? And if you may be kind
> to explain give me further information on using Primary Keys in postgreSQL
> (and pgAdmin). The same case with the foreign keys.

Any tutorial on databases will explain PKs and FKs much better than I
can; they're not specific to Postgres.

HTH,

Ray.

-- 
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie


Re: Primary & Foreign Keys in pgAdmin

От
MrTeeth
Дата:
Thanks a lot Raymond, that was helpful!

--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Primary-Foreign-Keys-in-pgAdmin-tp5569384p5569531.html
Sent from the PostgreSQL - pgadmin support mailing list archive at Nabble.com.