Eine Einführung in

SQL

How can you determine the primary key using SQL?

PostgreSQL
If you have access to the SQL code which created the table the primary key can be seen easily. The primary key may be specified in one of two ways:
CREATE TABLE cia (name PRIMARY KEY, population INTEGER)
or, where the primary key is composite:
CREATE TABLE casting(movieid INTEGER,
                     actorid INTEGER,
                     PRIMARY KEY (movieid, actorid)
                     )
If this is not possible then implementation specific commands may work.


Specific to PostgreSQL
The array returned indicates which fields contribute to the primary key. {1,2} means that the first and second field of casting contribute to the primary key.