0

How do I set primary keys and foreign keys in a table?

3rd Sep 2016, 8:28 PM
Mokgaetji Prudence Manyama
Mokgaetji Prudence Manyama - avatar
4 odpowiedzi
+ 1
create table tablename (name(varchar).....) primary key = name
4th Sep 2016, 4:27 AM
Yogendra Asher
Yogendra Asher - avatar
0
create table ***** (name(vachar).......... primary key=name
4th Sep 2016, 3:41 AM
Noah Smith
Noah Smith - avatar
0
To add foreign key Alter table tablename add constraint_name foreign key (column_name) references (column_name)
4th Sep 2016, 1:23 PM
Shruti
0
alter table table_name add constraint_name primary key (column1,column2,...); You can create one primary key for each table not more than that but yes, you can select multiple columns if you want
8th Sep 2016, 2:12 AM
Yunus Kolsawala
Yunus Kolsawala - avatar