CREATE PROCEDURE usersByContinent() BEGIN SELECT continent, SUM(users) AS users FROM countries GROUP BY continent ORDER BY users DESC; END
21 January 2018
usersByContinent
My solution:
Labels:
Arcade,
CodeSignal,
Databases,
GROUP Dishes BY Type,
MySQL
20 January 2018
itemCounts
My solution:
CREATE PROCEDURE itemCounts() BEGIN SELECT item_name, item_type, COUNT(*) AS item_count FROM availableItems GROUP BY item_name, item_type ORDER BY item_type, item_name; END
Labels:
Arcade,
CodeSignal,
Databases,
GROUP Dishes BY Type,
MySQL
countriesInfo
My solution:
CREATE PROCEDURE countriesInfo() BEGIN SELECT COUNT(*) AS number, AVG(population) AS average, SUM(population) AS total FROM countries; END
Labels:
Arcade,
CodeSignal,
Databases,
GROUP Dishes BY Type,
MySQL
19 January 2018
testCheck
My solution:
CREATE PROCEDURE testCheck() SELECT id, IF (given_answer IS NULL, "no answer", CASE WHEN given_answer = correct_answer THEN "correct" ELSE "incorrect" END) AS checks FROM answers ORDER BY id;
Labels:
Arcade,
CodeSignal,
Databases,
MySQL,
Would you LIKE the Second Meal?
newsSubscribers
My solution:
CREATE PROCEDURE newsSubscribers() BEGIN SELECT DISTINCT subscriber FROM full_year WHERE full_year.newspaper LIKE "%Daily%" UNION SELECT DISTINCT subscriber FROM half_year WHERE half_year.newspaper LIKE "%Daily%" ORDER BY subscriber ASC; END
Labels:
Arcade,
CodeSignal,
Databases,
MySQL,
Would you LIKE the Second Meal?
15 August 2017
List Beautifier
My solution:
Previous
def listBeautifier(a): res = a[:] while res and res[0] != res[-1]: b, *res, c = res return res
Previous
Labels:
Arcade,
CodeSignal,
Meet Python,
Python,
Python 3
Mex Function
My solution:
Previous Next
def mexFunction(s, upperBound): found = -1 for i in range(upperBound): if not i in s: found = i break else: found = upperBound return found
Previous Next
Labels:
Arcade,
CodeSignal,
Meet Python,
Python,
Python 3
Subscribe to:
Comments (Atom)