{"id":15002488,"url":"https://github.com/shvetsihorr/sql-projects","last_synced_at":"2026-03-15T02:43:47.589Z","repository":{"id":256957891,"uuid":"856903484","full_name":"shvetsihorr/SQL-Projects","owner":"shvetsihorr","description":"SQL and Google BigQuery-Portfolio Projects","archived":false,"fork":false,"pushed_at":"2024-09-14T19:26:58.000Z","size":96,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-18T12:16:01.427Z","etag":null,"topics":["azuredatastudio","bigquery","mssql","postgresql","sql"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shvetsihorr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-09-13T12:32:53.000Z","updated_at":"2024-09-14T19:27:01.000Z","dependencies_parsed_at":"2024-09-14T04:24:53.471Z","dependency_job_id":"9578400b-9344-46c3-8e19-23db65e09d12","html_url":"https://github.com/shvetsihorr/SQL-Projects","commit_stats":{"total_commits":38,"total_committers":1,"mean_commits":38.0,"dds":0.0,"last_synced_commit":"efa9b1dd54a7fd7faded6e7982a055ab529f1cbc"},"previous_names":["shvetsihorr/sql-projects"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shvetsihorr%2FSQL-Projects","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shvetsihorr%2FSQL-Projects/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shvetsihorr%2FSQL-Projects/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shvetsihorr%2FSQL-Projects/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shvetsihorr","download_url":"https://codeload.github.com/shvetsihorr/SQL-Projects/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243146847,"owners_count":20243740,"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":["azuredatastudio","bigquery","mssql","postgresql","sql"],"created_at":"2024-09-24T18:50:44.449Z","updated_at":"2025-12-25T02:36:27.592Z","avatar_url":"https://github.com/shvetsihorr.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQL and Google BigQuery-Portfolio Projects\nWelcome to my portfolio, where I showcase my expertise in SQL and Google BigQuery through various product/eCommerce and marketing analytics projects. These projects demonstrate my ability to analyze and optimize ad performance, track eCommerce funnel progression, and generate actionable insights from large datasets. From calculating campaign metrics to exploring conversion rates and user engagement, my work reflects a deep understanding of both marketing and product analytics.\n\nFeel free to connect with me via: \nLinkedIn [Ihor Shvets](https://www.linkedin.com/in/ihorshvets/), Email: [shvets.ihor@outlook.com](mailto:shvets.ihor@outlook.com)\n\n## Tools Used:\n- **PostgreSQL**: For querying and analyzing data across various projects.\n- **Google BigQuery**: For managing and analyzing large datasets, especially in eCommerce and ad performance analysis.\n- **Google Analytics 4 (GA4)**: For accessing eCommerce data in BigQuery.\n\n## Table of Contents\n\n- [Projects](#projects)\n  - [Project 1: Daily Campaign Performance Metrics](#project-1-daily-campaign-performance-metrics)\n  - [Project 2: Combining Facebook and Google Ads Data](#project-2-combining-facebook-and-google-ads-data)\n  - [Project 3.1: Campaign Performance Analysis Across Facebook and Google Ads](#project-31-campaign-performance-analysis-across-facebook-and-google-ads)\n  - [Project 3.2: Campaign ROMI Analysis with SQL](#project-32-campaign-romi-analysis-with-sql)\n  - [Project 4: Metrics Calculation and UTM Campaign Tracking with SQL](#project-4-metrics-calculation-and-utm-campaign-tracking-with-sql)\n  - [Project 5: Data Preparation for BI Reporting using Google BigQuery](#project-5-data-preparation-for-bi-reporting-using-google-bigquery)\n  - [Project 6: Conversion Calculation by Date and Traffic Channel using Google BigQuery](#project-6-conversion-calculation-by-date-and-traffic-channel-using-google-bigquery)\n  - [Project 7: Comparison of Conversion Rates Between Different Landing Pages using Google BigQuery](#project-7-comparison-of-conversion-rates-between-different-landing-pages-using-google-bigquery)\n  - [Project 8: Correlation Analysis Between User Engagement and Purchases using Google BigQuery](#project-8-correlation-analysis-between-user-engagement-and-purchases-using-google-bigquery)\n- [Skills Demonstrated](#skills-demonstrated)\n- [Contact](#contact)\n\n\n## Projects:\n### Project 1: Daily Campaign Performance Metrics\nThis SQL query aggregates daily performance data for ad campaigns from the facebook_ads_basic_daily table. It calculates key metrics including total spend, impressions, clicks, and value, as well as Cost Per Click (CPC), Cost Per Thousand Impressions (CPM), Click-Through Rate (CTR), and Return on Marketing Investment (ROMI). Results are grouped by date and campaign ID, with metrics rounded to the nearest whole number or two decimal places as appropriate.\n\n[View SQL query](https://github.com/shvetsihorr/SQL-Projects/blob/ec56831b78293c482737756f23f2970a6c12dd86/SQL%20script%20Daily%20Campaign%20Performance%20Metrics.sql)\n\n\u003cimg width=\"1470\" alt=\"Daily Campaign Performance Metrics\" src=\"https://github.com/user-attachments/assets/69cc8c9a-b5b7-4360-9c14-65eb4c7ea2df\"\u003e\n\n### Project 2: Combining Facebook and Google Ads Data\nIn this project, I used SQL to combine data from two tables, facebook_ads_basic_daily and google_ads_basic_daily, using a Common Table Expression (CTE). The query aggregates metrics for ad campaigns from both sources by date and media source. The key metrics include total spend, impressions, clicks, and conversion value. This approach provides a unified view of ad performance across platforms.\n\n[View SQL query](https://github.com/shvetsihorr/SQL-Projects/blob/ec56831b78293c482737756f23f2970a6c12dd86/SQL%20script%20Combining%20Facebook%20and%20Google%20Ads%20Data.sql)\n\n\u003cimg width=\"949\" alt=\"Combining Facebook and Google Ads Data\" src=\"https://github.com/user-attachments/assets/a61ec16d-7411-4278-a1ce-d60f2aea5439\"\u003e\n\n### Project 3.1: Campaign Performance Analysis Across Facebook and Google Ads\nIn this project, I combined data from four tables, and using CTEs, I merged Facebook and Google Ads data to analyze campaign performance. The query calculated daily metrics like spend, impressions, clicks, and conversion value, grouped by date, media source, campaign, and ad set.\n\nThis analysis provided a unified view of ad performance across both platforms.\n\n[View SQL query](https://github.com/shvetsihorr/SQL-Projects/blob/8c691946f583ff8cdaac92385f00fc1b2ad7282c/SQL%20script%20Campaign%20Performance%20Analysis%20Facebook%20and%20Google%20Ads.sql)\n\n\u003cimg width=\"1208\" alt=\"Campaign Performance Analysis Facebook and Google Ads\" src=\"https://github.com/user-attachments/assets/82395a5c-8866-4f4c-a58e-68da97324756\"\u003e\n\n### Project 3.2 Campaign ROMI Analysis with SQL\n - Identified the campaign with the highest ROMI (spend \u003e 500,000).\n- Found the ad set with the highest ROMI within that campaign.\n\nSummary:\nThis project highlights my SQL skills in merging data, calculating marketing metrics, and analyzing ad performance.\n\n[View SQL query](https://github.com/shvetsihorr/SQL-Projects/blob/e8551a1e41a996d0c9bb75eb909443ec5c528c22/SQL-Campaign%20ROMI%20Analysis%20.sql)\n\n\u003cimg width=\"614\" alt=\"Campaign ROMI Analysis with SQL\" src=\"https://github.com/user-attachments/assets/d0e43738-15cf-42b6-9bca-1b36705d0c89\"\u003e\n\n### Project 4: Metrics Calculation and UTM Campaign Tracking with SQL\n\nIn this project, I used SQL to merge daily performance data from both Facebook and Google Ads into a unified dataset. I extracted key UTM campaign parameters and calculated essential advertising metrics such as CTR, CPC, CPM, and ROMI. The process involved handling null values, applying regular expressions to retrieve UTM parameters, and using CASE statements to avoid division errors. This project showcases my ability to work with large datasets, perform detailed campaign analysis, and generate actionable insights for marketing performance tracking.\n\n[View SQL query](https://github.com/shvetsihorr/SQL-Projects/blob/cea751891831a824f4240ffc47d349d38bc3076a/Metrics%20and%20UTM%20Campaign%20Tracking%20with%20SQL.sql)\n\n\u003cimg width=\"1469\" alt=\"UTM Campaign Tracking and Metrics Calculation\" src=\"https://github.com/user-attachments/assets/28a8a084-9366-4044-bc05-55c7fea581b8\"\u003e\n\n### Project 4.2: Calculating Month-over-Month Differences for CPC, CPM, and ROMI by UTM Campaign\n\nFor this project, I built on a previous SQL task to analyze monthly ad performance. I used Common Table Expressions (CTEs) to group data by the first day of the ad month, aggregating metrics such as total spend, impressions, clicks, conversion value, CTR, CPC, CPM, and ROMI.\n\nIn this SQL query, I introduced a calculation to compare CPM, CTR, and ROMI performance month-over-month for each UTM campaign, expressed as a percentage change. This project demonstrates my ability to perform advanced data aggregation, time-based comparisons, and insights generation for marketing performance analysis.\n\n[View SQL query](https://github.com/shvetsihorr/SQL-Projects/blob/bab6eee9eeef8a687ed634269fbcb3e64c1632b6/Calculating%20Month-over-Month%20Differences%20for%20CPC%2C%20CPM%2C%20and%20ROMI%20by%20UTM%20Campaign.sql)\n\n\u003cimg width=\"1468\" alt=\"Calculating Month-over-Month Differences for CPC, CPM, and ROMI by UTM Campaign\" src=\"https://github.com/user-attachments/assets/694c658d-00c4-485e-98dd-3b5a09dac02a\"\u003e\n\n### Project 5: Data Preparation for BI Reporting using Google BigQuery\n\nIn this project, I practiced writing SQL queries in BigQuery using the free Google Analytics 4 (GA4) dataset. My focus was on analyzing eCommerce funnel progression.\n\n[View Project on Google BigQuery if you have an account](https://console.cloud.google.com/bigquery?sq=450854397335:f6e0ae0e1322400e8f236a08a46514af)\n\n[View BigQuery SQL as download file](https://github.com/shvetsihorr/SQL-Projects/blob/fc38bb18e8db4a3c14e7cd1e6501e5c08fabd5ee/BigQuery%20Data%20Preparation%20for%20BI%20Reporting%20using%20Google%20BigQuery.sql)\n\n\u003cimg width=\"1464\" alt=\" Data Preparation for BI Reporting using Google BigQuery\" src=\"https://github.com/user-attachments/assets/1f2e7b65-508b-488c-b676-308f1ec851a2\"\u003e\n\n\n### Project 6: Conversion Calculation by Date and Traffic Channel using Google BigQuery\n\nFor this task, I created a query to calculate conversions from session start to purchase, segmented by date and traffic channel.\n\nNote: The query considered both session and user IDs to ensure accurate counts of unique sessions by unique users, as different users might have the same session IDs.\n\nThis analysis provided insights into how conversions progress through different stages of the user journey, segmented by date and traffic channel.\n\n[View Project on Google BigQuery if you have an account](https://console.cloud.google.com/bigquery?sq=450854397335:1ad7f81432424c209dcf7e359b8c61b4)\n\n[View BigQuery SQL as download file](https://github.com/shvetsihorr/SQL-Projects/blob/fa9fb14e9c05db5a098d7b09e855c01072a30b78/BigQuery%20-Conversion%20Calculation%20by%20Date%20and%20Traffic%20Channel%20using%20Google.sql)\n\n\u003cimg width=\"1470\" alt=\"Conversion Calculation by Date and Traffic Channel\" src=\"https://github.com/user-attachments/assets/d95a81df-55cd-4664-9162-2b9184ebee2c\"\u003e\n\n### Project 7. Comparison of Conversion Rates Between Different Landing Pages using Google BigQuery\n\nFor this task, I analyzed conversion rates across different landing pages.\nObjective: I created a query to extract the page_path from the page_location in session start events for the year 2020. For each unique landing page, I calculated:\n\n- The number of unique sessions by unique users.\n- The number of purchases.\n- The conversion rate from session start to purchase.\n\nNote: Since session start and purchase events may have different URLs, I merged these events using user and session identifiers to ensure accurate conversion tracking.\n\nThis analysis provided insights into how different landing pages perform in terms of driving conversions.\n\n[View Project on Google BigQuery if you have an account](https://console.cloud.google.com/bigquery?sq=450854397335:1d00f422ab3e4b49979d80373f5f2a13)\n\n[View BigQuery SQL as download file](https://github.com/shvetsihorr/SQL-Projects/blob/88569480d9cc22fac289a54a948f9926570c6e37/BigQuery%20Comparison%20of%20Conversion%20Rates%20Between%20Different%20Landing%20Pages.sql)\n\n\u003cimg width=\"1385\" alt=\"Comparison of Conversion Rates Between Different Landing Pages\" src=\"https://github.com/user-attachments/assets/2a35c45a-9039-493f-a4c0-b0fe6e68dcbf\"\u003e\n\n### Project 8. Correlation Analysis Between User Engagement and Purchases using Google BigQuery\n\nFor this task, I assessed the correlation between user engagement and purchase behavior. I determined for each unique session:\n- Whether the user was engaged (if session_engaged parameter equals ‘1’).\n- The total engagement time during the session (sum of engagement_time_msec across events).\n- Whether a purchase occurred during the session.\n\nI then calculated the correlation coefficients:\n\n- Between user engagement and purchase occurrence.\n- Between total engagement time and purchase occurrence.\n\nI merged session start events with other session events using user and session identifiers to ensure accurate correlation analysis.\n\n[View Project on Google BigQuery if you have an account](https://console.cloud.google.com/bigquery?sq=450854397335:307578fcb5cf4a2e948e76f160aa3215)\n\n[View BigQuery SQL as download file](https://github.com/shvetsihorr/SQL-Projects/blob/1edaa46ff6e6e641ed3154a2673ca337ec639227/Correlation%20Analysis%20Between%20User%20Engagement%20and%20Purchases%20using%20Google%20BigQuery.sql)\n\n\u003cimg width=\"1355\" alt=\"Correlation Analysis Between User Engagement and Purchases\" src=\"https://github.com/user-attachments/assets/ee52b29a-cd4a-4dcd-9f09-e93899114659\"\u003e\n\n### Skills Demonstrated:\n### SQL Querying and Data Management\n\n- Data Aggregation: Expertise in aggregating daily and monthly performance metrics from ad campaign data, including spend, impressions, clicks, CTR, CPC, CPM, and ROMI.\n- Complex Joins and CTEs: Proficiency in using Common Table Expressions (CTEs) to combine and analyze data from multiple tables, such as combining Facebook and Google Ads data.\n- Advanced Calculations: Ability to perform advanced calculations for marketing metrics and analyze month-over-month differences for CPC, CPM, and ROMI.\n- Error Handling: Skilled in handling null values, applying regular expressions, and using CASE statements to avoid errors in calculations.\n\n### Google BigQuery\n\n- Large Dataset Management: Experience in managing and querying large datasets using Google BigQuery, particularly for eCommerce and ad performance analysis.\n- Conversion Funnel Analysis: Competence in analyzing eCommerce funnel progression and calculating conversions segmented by date and traffic channel.\n- Performance Tracking: Proficiency in tracking and comparing conversion rates across different landing pages, and conducting correlation analysis between user engagement and purchases.\n- Data Preparation and BI Reporting\n- Data Preparation: Ability to prepare and clean data for Business Intelligence (BI) reporting, ensuring accurate and actionable insights.\n- Correlation Analysis: Experience in performing correlation analysis to determine relationships between user engagement metrics and purchase behavior.\n\n### Analytical Skills\n- Insight Generation: Demonstrated ability to generate actionable insights from data to inform marketing strategies and improve campaign performance.\n- Detailed Reporting: Skilled in creating detailed reports and visualizations to convey complex data analysis effectively.\n\n### Contact\nFeel free to connect with me via: \n - LinkedIn https://www.linkedin.com/in/ihorshvets/,\n - Email: shvets.ihor@outlook.com\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshvetsihorr%2Fsql-projects","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshvetsihorr%2Fsql-projects","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshvetsihorr%2Fsql-projects/lists"}