11. Get Colonists Count Databases MSSQL Server Exam - 28 Jun 2020 Пообни решения , различен резултат
Здравейте,
Може ли някой да даде предложение защо две еднакви в резултатите си решения, дават различни точки в джъдж?
Това дава 5 точки:
CREATE FUNCTION dbo.udf_GetColonistsCount(@PlanetName VARCHAR (30))
RETURNS INT
BEGIN
DECLARE @Result int=(SELECT
COUNT(tc.ColonistId)
FROM Planets AS p
LEFT JOIN Spaceports AS s ON p.Id=s.PlanetId
LEFT JOIN Journeys AS j ON j.DestinationSpaceportId=s.Id
LEFT JOIN TravelCards AS tc ON j.Id=tc.JourneyId
GROUP BY p.Name
HAVING p.Name=@PlanetName)
RETURN @Result;
END
Това дава 10 точки:
CREATE FUNCTION dbo.udf_GetColonistsCount(@PlanetName VARCHAR (30))
RETURNS INT
AS
BEGIN
DECLARE @Result int=(SELECT
COUNT(*)
FROM Planets AS p
left JOIN Spaceports AS s ON p.Id=s.PlanetId
left JOIN Journeys AS j ON j.DestinationSpaceportId=s.Id
left JOIN TravelCards AS tc ON j.Id=tc.JourneyId
WHERE p.Name=@PlanetName)
RETURN @Result;
END
Благодаря!