Tasks Details
elementary
1.
SqlSum
Calculate sum of elements.
Task Score
100%
Correctness
100%
Performance
Not assessed
Given a table elements with the following structure:
create table elements ( v integer not null )write an SQL query that returns the sum of the numbers in column v.
For example, given:
v --- 2 10 20 10your query should return 42.
Copyright 2009–2025 by Codility Limited. All Rights Reserved. Unauthorized copying, publication or disclosure prohibited.
Solution
Programming language used SQL (SQLite)
Time spent on task 1 minutes
Notes
not defined yet
Code: 09:50:04 UTC,
sql-postgres,
autosave
Code: 09:50:13 UTC,
sql-postgres,
autosave
Code: 09:50:13 UTC,
sql,
autosave
Code: 09:50:21 UTC,
sql,
autosave
Code: 09:50:24 UTC,
sql,
verify,
result: Failed
User test case 1:
"insert into elements values (10);\ninsert into elements values (37);"
Analysis
expand all
Example tests
1.
0.129 s
OK
function result: +----+ | 42 | +----+
function result: +----+ | 42 | +----+
expand all
User tests
1.
0.126 s
RUNTIME ERROR
stderr:
E sql_runner.exceptions.CodilityRuntimeError: Error in query: "insert into elements values (10);\ninsert into elements values (37);", details: near ""insert into elements values (10);\ninsert into elements values (37);"": syntax error
Code: 09:50:33 UTC,
sql,
verify,
result: Failed
Analysis
expand all
Example tests
1.
0.125 s
OK
function result: +----+ | 42 | +----+
function result: +----+ | 42 | +----+
Code: 09:50:38 UTC,
sql,
final,
score: 
100
Analysis summary
The solution obtained perfect score.
Analysis
expand all
Example tests
1.
0.107 s
OK
function result: +----+ | 42 | +----+
function result: +----+ | 42 | +----+
expand all
Correctness tests
1.
0.105 s
OK
function result: +----+ | 55 | +----+
function result: +----+ | 55 | +----+
1.
0.002 s
OK
function result: +----+ | 45 | +----+
function result: +----+ | 45 | +----+
1.
0.002 s
OK
function result: +----+ | 12 | +----+
function result: +----+ | 12 | +----+
1.
0.002 s
OK
function result: +----+ | 10 | +----+
function result: +----+ | 10 | +----+
1.
0.002 s
OK
function result: +----+ | 76 | +----+
function result: +----+ | 76 | +----+
1.
0.002 s
OK
function result: +----+ | 31 | +----+
function result: +----+ | 31 | +----+
1.
0.002 s
OK
function result: +-----+ | 167 | +-----+
function result: +-----+ | 167 | +-----+
1.
0.002 s
OK
function result: +-------+ | -1000 | +-------+
function result: +-------+ | -1000 | +-------+
1.
0.004 s
OK
function result: +-------+ | 11800 | +-------+
function result: +-------+ | 11800 | +-------+
1.
0.263 s
OK
function result: +---------+ | 1810000 | +---------+
function result: +---------+ | 1810000 | +---------+