SELECT p.id, d.name, p.item, p.price, min(p.price) over(), p.price-min(p.price) over() FROM purchase p join department d on p.department_id=d.id
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter