Open
Conversation
- Defines the EMPLOYEE table using data from hr/employee_index.csv. - Inserts sample employee records. - Created create_expenses.sql: - Defines the EXPENSE table for storing last night's receipts. - Inserts expense data from the finance/receipts_from_last_night files. - Includes inline comments to explain the approach and optimizations. - Created create_invoices.sql: - Defines the INVOICE and SUPPLIER tables. - Inserts invoice data from the finance/invoices_due files. - Assigns supplier IDs (sorted alphabetically) and sets due dates as the last day of the month. - Created calculate_largest_expensors.sql: - Aggregates employee expenses to report those with a total expensed amount over 1000. - Joins EMPLOYEE and EXPENSE tables and retrieves manager names via a self-join. - Created find_manager_cycles.sql: - Implements a recursive CTE to detect cycles in the employee-manager relationships. - Returns each employee_id along with the detected loop (manager cycle) as a comma-separated list. - Created generate_supplier_payment_plans.sql: - Generates a monthly supplier payment plan using UNNEST and sequence to simulate monthly payments. - Calculates payment amounts, outstanding balances, and corresponding payment dates. - Avoids a recursive CTE to ensure compatibility with Trino.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Defines the EMPLOYEE table using data from hr/employee_index.csv.
Inserts sample employee records.
Created create_expenses.sql:
Created create_invoices.sql:
Created calculate_largest_expensors.sql:
Created find_manager_cycles.sql:
Created generate_supplier_payment_plans.sql: