- Visit https://tsu-haoliu.github.io/support_engineer_homework
- Select a report option from the dropdown menu
- Report #1: Enter
myShopifyDomain
in input field, then click submit - Report #2: Click generate report button to show all organizations sorted by oldest to newest
- Report #3: Click generate report button to return the list of organizations whose status is cancelled
- Report #4: Enter an
orgName
in input field, then click submit to view the organization's record in JSON format.
SELECT org.orgName, org.id,
(SELECT COUNT(*)
FROM organization org
LEFT JOIN account ap ON org.id = ap.organizationId
WHERE ap.organizationId IS NULL) AS orgs_without_plans
FROM organization as org
LEFT JOIN account as ap ON org.id = ap.organizationId
WHERE ap.organizationId IS NULL
SELECT org.orgName, org.id, COUNT(ap.id) AS num_plans
FROM organization as org
JOIN account as ap ON org.id = ap.organizationId
GROUP BY org.id
HAVING COUNT(ap.id) > 1
SELECT org.orgName, org.id
FROM organization as org
JOIN account as ap ON org.id = ap.organizationId
GROUP BY org.id
HAVING COUNT(ap.id) = 1
SELECT org.orgName, org.id
FROM organization as org
JOIN account as ap ON org.id = ap.organizationId
WHERE ap.features LIKE '%"PASSWORDLESS":%true%'
- Fork this repository.
- Add
smartrr-hello
as a collaborator to your repository. - Use the test data to answer the questions below. The test data is in CSV form in two tabs. Each tab represents a table:
- organization
- account
- Add all SQL and JavaScript files to your fork.
- Write a README explaining how to run your application.
- Push up your submission and let us know where to find it.
Use JS and SQL to answer the following questions.
JavaScript
- Write a JavaScript application. The app can be a CLI or web-based app. It should provide a user with the options to run four reports:
- Takes the value of a
myShopifyDomain
field as an input and returns theiroptimization
settings. - Loops through all organizations and shows the date they were created (DD/MM/YYYY), their
status
, andplanName
sorted by oldest to newest. - Returns the list of organizations whose status is cancelled.
- Takes the value of an
orgName
and returns the organization record in JSON format.
- Takes the value of a
SQL
- Write SQL queries to return:
- How many organizations do not have account plans?
- How many organizations have more than one account plan?
- List all organizations that have only one account plan.
- List all organizations that have the PASSWORDLESS feature set to true.