{"id":25021963,"url":"https://github.com/nbryttel/sql-taxdatabase","last_synced_at":"2025-10-18T02:31:42.849Z","repository":{"id":274167956,"uuid":"922118287","full_name":"Nbryttel/sql-taxdatabase","owner":"Nbryttel","description":"SQL-Taxdatabase (Tax Expense Schema) is a relational database schema designed to manage tax-related expenses.","archived":false,"fork":false,"pushed_at":"2025-01-27T17:58:50.000Z","size":72,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T21:41:53.732Z","etag":null,"topics":["architecture","azure","data-science","sql","tableau","visualization"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nbryttel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-25T11:15:32.000Z","updated_at":"2025-01-27T19:19:09.000Z","dependencies_parsed_at":"2025-02-07T03:15:18.654Z","dependency_job_id":null,"html_url":"https://github.com/Nbryttel/sql-taxdatabase","commit_stats":null,"previous_names":["nbryttel/sql_taxdatabase","nbryttel/taxdatabase","nbryttel/sql-taxdatabase"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nbryttel%2Fsql-taxdatabase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nbryttel%2Fsql-taxdatabase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nbryttel%2Fsql-taxdatabase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nbryttel%2Fsql-taxdatabase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nbryttel","download_url":"https://codeload.github.com/Nbryttel/sql-taxdatabase/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246314118,"owners_count":20757457,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["architecture","azure","data-science","sql","tableau","visualization"],"created_at":"2025-02-05T13:38:42.423Z","updated_at":"2025-10-18T02:31:42.792Z","avatar_url":"https://github.com/Nbryttel.png","language":null,"readme":"# SQL-Taxdatabase (Tax Expense Schema)\n\nA database schema for managing tax-related expenses.\n\n![github prezent](https://github.com/user-attachments/assets/c3372657-ea3a-442d-ba43-8561987e4b7a)\n\n\n## Overview\nThis project defines a relational database schema to manage tax-related expenses. It categorizes expenses into different dimensions like courses, conferences, and travel, and provides calculated columns for automatic data handling. The aim was to extract actionable insights that help optimize budgets, monitor trends, and support strategic decisions.\n\n## Tools used:\n- SQL Server on Azure: Database hosting and management.\n- Azure Data Studio: Query development and data exploration.\n- Tableau: Visualization of insights and reporting.\n- Lucidchart: Designing the database schema and entity relationships.\n\n## Skills Demonstrated\nAs a data analyst, I applied the following skills:\n- Data Modeling: Designing a relational database for structured storage of expense data.\n- Data Wrangling: Writing SQL queries to clean, transform, and prepare data for analysis-\n- Data Analysis: Extracting meaningful patterns and trends from large datasets.\n- Reporting and Visualization: Presenting results with dynamic dashboards.\n\n## Workflow\n1. Designed Entity-Relationship Diagram (ERD), defining tables, establishing relationships, and normalizing data to ensure consistency, accuracy, and scalability.\n3. Database Setup:\n- Designed a database schema to manage expenses with tables for travels, conferences, meetings, and more.\n- Deployed the database on SQL Server (Azure).\n2. Data Exploration:\n- Populated the database with sample data for business travel and related expenses.\n- Wrote SQL queries to calculate total expenses, tips, and other key metrics.\n3. Analysis:\n-Performed cost analysis based on event type, location, and year.\n- Identified high-cost trends and potential areas for savings.\n4. Visualization:\n- Migrated the data to Tableau to create dashboards with insights such as:\n- Year-over-year expense comparisons\n- Breakdown of costs by location and event type.\n- Trends in business vs. personal travel costs.\n\n\n![code i yoytube (1)](https://github.com/user-attachments/assets/d2f7c661-5379-4546-b50c-7b19b6b1c74c)\n\n\n## Check Live Data Analysis Recording \nhttps://www.youtube.com/watch?v=gpad3xV-eWc\n\n\n## Example SQL Code\n\n\n### Table Example\n```sql\nCREATE TABLE dbo.DimTravel (\n    TravelID INT IDENTITY(1,1) PRIMARY KEY,\n    TaxYear INT NOT NULL,\n    TravelCity NVARCHAR(100) NOT NULL,\n    TravelCountry NVARCHAR(5) NOT NULL,\n    TravelYear INT NOT NULL,\n    TravelMonth NVARCHAR(50) NOT NULL CHECK (TravelMonth IN (\n        'January', 'February', 'March', 'April', 'May', 'June', \n        'July', 'August','September', 'Oktober' 'November', 'December'\n    )),\n    TotalExpenseEUR DECIMAL(10,2) AS (HotelExpense + ISNULL(HotelTip, 0.00)) PERSISTED\n);\n```\n\n### Sample Query 1\n```sql\nSELECT \n    TravelMonth,\n    SUM(TotalExpenseEUR) AS TotalMonthlyExpenses\nFROM dbo.DimTravel\nGROUP BY TravelMonth\nORDER BY TotalMonthlyExpenses DESC;\n```\n\n### Sample Query 2\n\n```sql\nSELECT\n    te.EventCity AS Destination, -- City of travel (basic travel information)\n    te.TaxYear AS TaxYear, -- Tax year associated with the travel expenses\n    te.ExpenseAmountEUR AS TravelExpenseAmountEUR, -- Main travel cost in EUR (e.g., hotel)\n    SUM(COALESCE(ate.ExpenseAmountEUR, 0)) AS TotalAdditionalExpenseAmountEUR, -- Total additional costs associated with the trip\n    te.ExpenseAmountEUR + SUM(COALESCE(ate.ExpenseAmountEUR, 0)) AS TotalTravelExpenses, -- Total travel costs (main + additional)\n    COALESCE(ce.ConferenceName, 'N/A') AS ConferenceName -- Name of the associated conference or \"N/A\" (if no association exists)\nFROM \n    dbo.DimTravelExpenses AS te -- Main table containing travel information\nLEFT JOIN \n    dbo.DimAdditionalTravelExpenses AS ate -- Join with the table of additional travel costs\nON \n    te.TravelID = ate.TravelID -- Linking additional expenses to the main trip using TravelID\nLEFT JOIN \n    dbo.DimTravelPurposeMapping AS tp -- Join with the table of travel purposes\nON \n    te.TravelID = tp.TravelID AND tp.PurposeType = 'Conference' -- Filtering travel purpose as \"Conference\"\nLEFT JOIN \n    dbo.DimConferencesExpenses AS ce -- Join with the conferences table\nON \n    tp.ConferenceID = ce.ConferenceID -- Linking the conference by its ID\nGROUP BY \n    te.EventCity, -- Grouping results by the city of travel\n    te.TaxYear, -- Grouping results by the tax year\n    te.HotelName, -- Grouping by hotel name (if available)\n    te.ExpenseAmountEUR, -- Grouping by main travel expenses\n    ce.ConferenceName; -- Grouping by conference name (if available)\n```\n\n## Features\n- Multiple dimensional tables (e.g., `DimCourses`, `DimConferences`, `DimTravel`).\n- Calculated fields for total expenses, tips, and travel distance.\n- Foreign key constraints to ensure referential integrity.\n- Cascading deletes for dependent data cleanup.\n\n## Key findings\n- Top Travel Destinations: Identified cities with the highest expenses for business-related events.\n- Cost Overruns: Highlighted events and categories where spending exceeded expected limits.\n- Trends Over Time: Analyzed how travel and conference expenses evolved over the years.\n- Optimization Opportunities: Suggested potential savings by prioritizing virtual meetings in certain locations.\n\n## Visual Dashboards\nSetting up dashboards:\n\n![Copy of Copy of cover UX FTI (35)](https://github.com/user-attachments/assets/4c845a93-7973-4d6a-942a-0df4e45cf9a5)\n\n![join](https://github.com/user-attachments/assets/23ca7a02-785a-44ff-91db-e07871bf4237)\n\n\n\nBelow is an example of the Tableau dashboard showcasing:\n\n![wykres](https://github.com/user-attachments/assets/c9fc5643-09d8-4dac-9377-ee8871c0c5bc)\n\n\nTotal expenses by year and event type.\nInteractive filters for country, event type, and date.\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss your ideas.\n\n## LICENSE\nThis project is licensed under the MIT License. See the LICENSE file for more details.\n\n## How to Use\n1. Clone the repository.\n2. Open the SQL script [Taxdatabase Script](./database_script.sql) in your preferred SQL environment, such as:\n- Azure Data Studio\n- SQL Server Management Studio (SSMS)\n3. Execute the scripts to:\n- Create the database schema: Set up all tables, constraints, and relationships.\n- Populate the tables with sample data (you can use: [Taxdatabase Seed Data Example](./seed_data.sql))\n4. Analyze the data:\n- Use the provided SQL queries (above: \"Sample Query 2\") or write your own to:\n- Retrieve insights (e.g., travel expenses by month).\n- Perform advanced analysis for reporting purposes.\n\nClone this repository:\n   ```bash\n   git clone https://github.com/Nbryttel/sql-taxdatabase.git\n ```\n\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbryttel%2Fsql-taxdatabase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnbryttel%2Fsql-taxdatabase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbryttel%2Fsql-taxdatabase/lists"}