Browse Source

Test 1: Simple join with a count and group

master
Nathan Bergey 5 months ago
parent
commit
5d03e883ec
  1. 2
      README.md
  2. 8
      test/test_example.py

2
README.md

@ -1,6 +1,8 @@
SQL test
===
Nathan's SQL answers. Tests past in `test/test_example.py`
### Prerequisistes
```bash

8
test/test_example.py

@ -43,6 +43,14 @@ class TestExample(DbTest):
)
sql = """
SELECT
COUNT(customers.*) AS "subordinates_count",
organizations.id AS "id"
FROM organizations
LEFT OUTER JOIN enterprise_sales_enterprise_customers customers ON customers.sales_organization_id = organizations.id
GROUP BY organizations.id
ORDER BY organizations.id ASC
;
"""
with conn.cursor(cursor_factory=RealDictCursor) as cur:
cur.execute(sql)

Loading…
Cancel
Save