aboutsummaryrefslogtreecommitdiff
path: root/dbinit/functions.sql
blob: 34a64bcf8fe15d1a7925a0325c9208eec9f23bae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use `formula1`;	
drop function if exists udfTotalDistance;

delimiter $$
create function udfTotalDistance(raceID int)
returns int
begin
	return (
		select `circuit`.`length` * `circuit`.`laps`
		from `race`
		inner join `circuit` on `circuit`.`ID` = `race`.`circuitID`
		where `race`.`ID` = raceID);
end$$

delimiter ;