Open arasbey opened 7 years ago
to add foreign key to table ;
alter table kisi add constraint fk_kisi_il_id foreign key (il_id) references il (id);
alter table kisi add constraint fk_kisi_ilce_id foreign key (ilce_id) references ilce (id);
to take a data in different tables ;
select kisi.id,ad,soyad,il.adi,ilce.adi from kisi join il on il.id=kisi.il_id join ilce on ilce.id=kisi.ilce_id
--to search all tables-- select * from tbl_kisi
select * from tbl_kisi where id=227
--To add a data to table INSERT INTO tbl_kisi (id,adi,soyadi,dogum_tarihi) VALUES (227,'Clayton','Harrell','17-07-20');
--To Update a data in table update tbl_kisi set adi='Veli' , soyadi='TEMEL' where id=227
--To Update all data update tbl_kisi set dogum_tarihi='1965-01-01' where id>200
--To delete any data delete from tbl_kisi where id=227
to insert a data in table for ex il table;
insert into il (id,adi,plaka_kodu) values (1,'ADANA','01'); insert into il (id,adi,plaka_kodu) values (2,'Adiyaman','02'); insert into il (id,adi,plaka_kodu) values (3,'Afyon','03');