Daily Shaarli
All links of one day in a single page.
The Belgian painter René Magritte created some of the most enigmatic and iconic works in Surrealist art.
In 1926 Magritte was commissioned to create the poster above for the popular singer Marie-Louise Van Emelen, better known as Primevère. For more of Magritte’s Art Deco sheet music covers, visit Hyperallergic.
Running Totals
SELECT id,month
, Amount
, SUM(Amount) OVER (ORDER BY id) as total_sum
FROM bill
Common Table Expressions
WITH idtempp as (
SELECT id as id
FROM id
WHERE country = "US"
AND status = "Y"
)
SELECT *
FROM bill
WHERE id in (SELECT id from idtempp)
Temporary Functions
Temporary functions allow you to modify the data easily without writing huge case statements.
CREATE TEMPORARY FUNCTION get_gender(type varchar) AS (
CASE WHEN type = "M" THEN "male"
WHEN type = "F" THEN "female"
ELSE "n/a"
END
)
SELECT
name,
get_gender(Type) as gender
FROM bill