{"id":26821511,"url":"https://github.com/harsh-arora-4114/e-commerce.sql","last_synced_at":"2025-03-30T07:31:06.919Z","repository":{"id":246661790,"uuid":"821794269","full_name":"Harsh-Arora-4114/e-commerce.sql","owner":"Harsh-Arora-4114","description":"This project provides a SQL-based solution for managing and analyzing data for a small e-commerce business. The database contains information about customers, suppliers, products, orders, and order details.","archived":false,"fork":false,"pushed_at":"2025-03-13T16:53:38.000Z","size":82,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T17:52:38.983Z","etag":null,"topics":["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/Harsh-Arora-4114.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-06-29T13:02:27.000Z","updated_at":"2025-03-13T16:53:42.000Z","dependencies_parsed_at":"2025-03-13T19:31:00.083Z","dependency_job_id":null,"html_url":"https://github.com/Harsh-Arora-4114/e-commerce.sql","commit_stats":null,"previous_names":["harsh-arora-4114/e-commerce.sql"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harsh-Arora-4114%2Fe-commerce.sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harsh-Arora-4114%2Fe-commerce.sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harsh-Arora-4114%2Fe-commerce.sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Harsh-Arora-4114%2Fe-commerce.sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Harsh-Arora-4114","download_url":"https://codeload.github.com/Harsh-Arora-4114/e-commerce.sql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246290555,"owners_count":20753723,"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":["sql"],"created_at":"2025-03-30T07:31:06.427Z","updated_at":"2025-03-30T07:31:06.902Z","avatar_url":"https://github.com/Harsh-Arora-4114.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# E-Commerce Database\n\n## Overview\nThis SQL script sets up a relational database for an e-commerce platform. It includes tables for customers, suppliers, products, orders, and order details, along with queries to analyze sales, top-selling products, and inventory management.\n\n## Database Schema\n### Tables\n1. **Customers** - Stores customer details.\n2. **Suppliers** - Stores supplier details.\n3. **Products** - Stores product information and references suppliers.\n4. **Orders** - Stores customer orders and their statuses.\n5. **OrderDetails** - Stores detailed order information, including quantity and price.\n\n### Relationships\n- **Products** references **Suppliers** (`SupplierID`).\n- **Orders** references **Customers** (`CustomerID`).\n- **OrderDetails** references **Orders** (`OrderID`) and **Products** (`ProductID`).\n\n## Setup Instructions\n1. **Create the Database and Tables**\n   ```sql\n   CREATE DATABASE ecommerce;\n   USE ecommerce;\n   ```\n2. **Run the provided SQL script to create tables and insert sample data.**\n\n## Queries Included\n- **Total Sales per Customer**: Calculates total revenue per customer.\n- **Top Selling Products**: Identifies the most sold products.\n- **Sales Trend Over Time**: Analyzes daily revenue.\n- **Average Order Value**: Computes the average value of orders.\n- **Inventory Management**: Lists products with stock greater than 2.\n\n## Example Usage\n### Retrieving Total Sales per Customer\n```sql\nSELECT C.CustomerName, SUM(OD.Quantity * OD.Price) as TotalSales\nFROM Customers C\nJOIN Orders O ON C.CustomerID = O.CustomerID\nJOIN OrderDetails OD ON O.OrderID = OD.OrderID\nGROUP BY C.CustomerName;\n```\n\n### Checking Inventory Levels\n```sql\nSELECT ProductName, Stock\nFROM Products\nWHERE Stock \u003e 2;\n```\n\n## Contributions\nFeel free to fork this repository, submit issues, or make pull requests.\n\n## License\nThis project is licensed under the MIT License.\n\n## Author\nDeveloped by Harsh Arora\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharsh-arora-4114%2Fe-commerce.sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharsh-arora-4114%2Fe-commerce.sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharsh-arora-4114%2Fe-commerce.sql/lists"}