반응형
For this challenge you need to create a basic Increment function which Increments on the age field of the peoples table.
The function should be called increment, it needs to take 1 integer and increment that number by 1.
You may query the people table while testing but the query must only contain the function on your final submit.
important: you must remove all comments when submitting the kata.
people table schema
- id
- name
- age
Solution:
CREATE FUNCTION increment(n int)
RETURNS
int AS $$
BEGIN
RETURN n+1;
END;
$$ LANGUAGE plpgsql;
Reference:
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
SQL Basics: Simple IN (0) | 2022.06.17 |
---|---|
Easy SQL: Absolute Value and Log to Base (0) | 2022.06.16 |
SQL with Street Fighter: Total Wins (0) | 2022.06.14 |
SQL Basics: Simple GROUP BY (0) | 2022.06.13 |
Keep Hydrated! (0) | 2022.06.12 |