I have a list of tables in a Netezza database and I want to get the name of primary key for each of the tables.
Can anyone provide me the query.
I have a list of tables in a Netezza database and I want to get the name of primary key for each of the tables.
Can anyone provide me the query.
We do not have
primary key
concept inNetezza
. If you are concerned aboutNot NULL
columns following query will help you.There is nothing sort of Primary Key thing in Netezza. If you want to look at the NULL or NOT NULL constraints for your required table you can enter the below commands from your nzsql command line
\d [YOURTABLENAME]
The key(primary/foreign) concepts is not there in Netezza. But we can create primary keys in Netezza and this is created to sync the model with the outside data reporting tools like Informatica/Microstrategy.
You can look into the system view _v_relation_keydata.
You can use this query.