Skip to content

Instantly share code, notes, and snippets.

@jozo
Created October 26, 2016 21:02
Show Gist options
  • Save jozo/5688bc2e41b74c2303c75cc5bbbaa9bc to your computer and use it in GitHub Desktop.
Save jozo/5688bc2e41b74c2303c75cc5bbbaa9bc to your computer and use it in GitHub Desktop.
SELECT
department, customer, supplier,
count(id)
FROM documents
WHERE supplier = 'ORANGE Slovensko'
AND supplier IS NOT NULL
AND department IS NOT NULL
AND customer IS NOT NULL
GROUP BY CUBE
(department, customer, supplier);
SELECT
department,
count(id)
FROM documents
WHERE supplier = 'ORANGE Slovensko'
GROUP BY department;
SELECT xmlelement(name foo, xmlattributes(current_date as bar), 'cont', 'ent');
SELECT xmlelement(name supplier, supplier)
FROM documents
LIMIT 10;
SELECT xmlelement(name supplier, (SELECT supplier FROM documents WHERE department = 'Ministerstvo zdravotníctva SR'))
FROM documents
LIMIT 10;
SELECT query_to_xml(query text, nulls boolean, tableforest boolean, targetns text)
SELECT * FROM query_to_xml('SELECT supplier FROM documents', true, false, 'pali')
SELECT xmlconcat('aaa', xmlagg(xmlelement(name supplier, supplier))) FROM documents WHERE department = 'Ministerstvo zdravotníctva SR'
SELECT department, xmlagg(xmlelement(name supplier, supplier)) FROM documents GROUP BY department LIMIT 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment