Im using DBDesigner and I can't figure out what is the funcionality with FKindexes?
For example, I have a table "ajovuoro" (im sorry the names are in finnish)
CREATE TABLE Ajovuoro (
idAjovuoro INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
Auto_Rekisterinumero VARCHAR(20) NOT NULL,
Kuljettaja_Hetu VARCHAR(20) NOT NULL,
paivamaara DATE NULL,
alkamisaika TIME NULL,
loppumisaika TIME NULL,
PRIMARY KEY(idAjovuoro, Auto_Rekisterinumero, Kuljettaja_Hetu),
And i have putted relations to Auto and Rekisterinumero. But why the DBD is making fields(when generating the MySQL code) INDEX Ajuovuoro_FKindex...and...FKindex2, can i just delete those. And when i want to join tables I will just do it when making MySQL queries? What for the program is making INDEX systems?
And why the code generator is putting tree primary keys? Should i just not to make relations becouse mysql code generator is making stupid staff if I make relations between the tables.
this is your first experience with foreign keys? perhaps you should take a tutorial
Correct! I havent worked with foreign keys and maybe I'm gonna look for the turorial right now - last time when I studied databases it was in university and there we were teached that you just join the tables in queries when you want to connect tables.
carId(relation to the car which car is the driver using)
And when I would like to find out which cars are drivers driving, I have to just make query like this:
Select * from car, driver where driver.carId = car.carID
(and relations were just made to understand better about which tables can be joinded together and how. For sure every one but the model of relations were just made for making better queries.) None of the relations were written in the SQL code.
But thanks for advising me, Im gonna look for tutorial first about foreing keys and then read your answer once again.
EDIT: actually, when I looked a tutorial, this driver.carId is working like a foreign key, correct? But still i cant understand why the DBDesigner is making it so complicated by using those index staff and putting tree primarykeys.