Answer the question
In order to leave comments, you need to log in
What is this type of sql query called?
Through phpmyAdmin I made such a request (football teams and games between them) -
and this is in the code
CREATE TABLE `game` (
`id_game` int(11) NOT NULL,
`date` date NOT NULL,
`place` varchar(255) NOT NULL,
`score` varchar(25) NOT NULL,
`fid_team1` int(11) NOT NULL,
`fid_team2` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `team` (
`id_team` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`leaque` varchar(255) NOT NULL,
`coach` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `game`
ADD PRIMARY KEY (`id_game`),
ADD KEY `game_ibfk_1` (`fid_team1`),
ADD KEY `game_ibfk_2` (`fid_team2`);
-- Индексы таблицы `team`
--
ALTER TABLE `team`
ADD PRIMARY KEY (`id_team`);
Answer the question
In order to leave comments, you need to log in
It is more correct to make an intermediate table for games, in this table create three connected fields, two of them with the id of the teams and the third field to connect with the game
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question