{"id":30172914,"url":"https://github.com/harmain-ali/postgre-sql-for-data-science","last_synced_at":"2026-04-08T20:51:37.997Z","repository":{"id":305019583,"uuid":"1021558866","full_name":"Harmain-Ali/POSTGRE-SQL-FOR-DATA-SCIENCE","owner":"Harmain-Ali","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-02T12:36:35.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-02T14:32:20.988Z","etag":null,"topics":["dataanalytics","database","database-design","database-management","datascience","dataset","postgres","postgresql","postgresql-database","postgressql","sql","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/Harmain-Ali.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,"zenodo":null}},"created_at":"2025-07-17T15:23:48.000Z","updated_at":"2025-08-02T12:36:38.000Z","dependencies_parsed_at":"2025-07-18T00:08:43.741Z","dependency_job_id":"90cb8098-e141-488b-b96b-e754122afa5e","html_url":"https://github.com/Harmain-Ali/POSTGRE-SQL-FOR-DATA-SCIENCE","commit_stats":null,"previous_names":["harmain-ali/postgre-sql-for-data-science"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Harmain-Ali/POSTGRE-SQL-FOR-DATA-SCIENCE","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harmain-Ali%2FPOSTGRE-SQL-FOR-DATA-SCIENCE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harmain-Ali%2FPOSTGRE-SQL-FOR-DATA-SCIENCE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harmain-Ali%2FPOSTGRE-SQL-FOR-DATA-SCIENCE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harmain-Ali%2FPOSTGRE-SQL-FOR-DATA-SCIENCE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Harmain-Ali","download_url":"https://codeload.github.com/Harmain-Ali/POSTGRE-SQL-FOR-DATA-SCIENCE/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harmain-Ali%2FPOSTGRE-SQL-FOR-DATA-SCIENCE/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269970136,"owners_count":24505478,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dataanalytics","database","database-design","database-management","datascience","dataset","postgres","postgresql","postgresql-database","postgressql","sql","sqlite"],"created_at":"2025-08-11T23:18:15.625Z","updated_at":"2026-04-08T20:51:37.988Z","avatar_url":"https://github.com/Harmain-Ali.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 📚 PostgreSQL Cheatsheet — From Zero to Hero 🚀\n\n![PostgreSQL](https://img.shields.io/badge/PostgreSQL-336791?style=for-the-badge\\\u0026logo=postgresql\\\u0026logoColor=white)\n![SQL](https://img.shields.io/badge/SQL-Basics-blue?style=for-the-badge)\n![Joins](https://img.shields.io/badge/SQL-JOINS-green?style=for-the-badge)\n![Queries](https://img.shields.io/badge/150%2B-Queries-orange?style=for-the-badge)\n![Data Science](https://img.shields.io/badge/Data%20Science-Friendly-purple?style=for-the-badge)\n\n## 🔥 What’s Inside?\n\nThis repo is your **ultimate PostgreSQL cheatsheet**, carefully crafted to take you from **absolute beginner → advanced SQL master**.\n\n* ✅ Complete **PostgreSQL Cheatsheet** with theory + SQL queries + pgAdmin steps\n* ✅ Covers **0 → Hero topics** (Databases, Tables, Queries, Joins, Subqueries, Functions, Views, Indexes, Transactions, Security, and more)\n* ✅ A **sample database (dvdrental)** with **150+ solved real-world questions** for practice\n* ✅ Perfect for **Data Scientists, Analysts, and Developers**\n\n## 🗂️ Topics Covered\n\n* Database Creation \u0026 Connections\n* Tables (Create, Modify, Drop)\n* Data Insertion, Import \u0026 Export\n* Filtering (WHERE, IN, BETWEEN, LIKE)\n* Sorting \u0026 Limiting\n* Aggregations \u0026 GROUP BY\n* Joins (INNER, LEFT, RIGHT, FULL, CROSS)\n* Subqueries \u0026 CTEs (WITH)\n* Views \u0026 Materialized Views\n* Functions, Procedures \u0026 Triggers\n* Window Functions\n* Indexes \u0026 Performance Optimization\n* Transactions \u0026 Concurrency Control\n* Security \u0026 User Management\n* Connecting PostgreSQL with Python (psycopg2 \u0026 SQLAlchemy)\n\n## 📝 Sample Practice Questions\n\n✔ **Basic SELECT Queries** → List all customers, find films longer than 100 mins, display rentals on a given date\n\n✔ **Filtering** → Customers from London, films with rental rate between 2–5, NULL checks\n\n✔ **Sorting \u0026 Limiting** → Top 10 expensive films, earliest rentals, most recent payments\n\n✔ **Joins** → Films with categories, customers with city names, rentals with staff names\n\n✔ **Aggregations** → Count films, calculate average payments, revenue per store\n\n✔ **Subqueries** → Most rented film, top customers, films longer than average\n\n✔ **Complex Joins** → Top 5 customers by rentals, total revenue per country, least rented film\n\n📌 More than **150+ solved examples** included using **dvdrental** database.\n\n## 🚀 How to Use\n\n1. Clone the repo\n\n   ```bash\n   git clone https://github.com/your-username/postgresql-cheatsheet.git\n   cd postgresql-cheatsheet\n   ```\n2. Import the sample **dvdrental** database into PostgreSQL.\n3. Explore `postgre_sql_cheatsheat.ipynb` for theory + queries.\n4. Try solving practice questions (`DVD-RENTAL-PRACTICE-QUESTIONS.txt`) in your own database.\n\n## 🔗 Related Resources\n\nExpand your learning beyond PostgreSQL:\n\n* 📊 [EDA Guide (Exploratory Data Analysis)](https://github.com/Harmain-Ali/Complete-EDA-Guide)\n* 🐍 [SQLAlchemy Cheatsheet](https://github.com/Harmain-Ali/SQLAlchemy-For-DataScience)\n\n\n## 🌟 Support\n\nIf you find this helpful:\n\n* ⭐ **Star this repo** to support my work\n* 👤 **Follow me** for more data science \u0026 SQL content\n* 🔔 Stay tuned for upcoming **Pandas Cheatsheet** \u0026 more advanced guides\n\n## 🏷️ Tags\n\n`postgresql` `sql` `cheatsheet` `database` `data-science` `joins` `queries` `data-analysis` `sqlalchemy` `pgadmin` `practice-questions` `dvdrental`\n\n⚡ With this guide, you’ll go from **writing your first SELECT query** → **mastering window functions, joins, optimization, and real-world analysis**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharmain-ali%2Fpostgre-sql-for-data-science","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharmain-ali%2Fpostgre-sql-for-data-science","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharmain-ali%2Fpostgre-sql-for-data-science/lists"}