A comprehensive collection of SQL database scripts covering Oracle, MySQL, and MS SQL Server implementations. This repository contains complete database schemas with tables, relationships, constraints, and sample data for various real-world applications.
- Overview
- Database Systems
- Repository Structure
- Databases Included
- Getting Started
- Usage
- Contributing
- License
This repository contains SQL scripts developed during database management coursework and projects. Each script represents a complete, production-ready database schema for different application domains including banking, e-commerce, library management, and student information systems.
Total Scripts: 7 complete database implementations
Supported Platforms: Oracle Database, MySQL, MS SQL Server
Purpose: Educational, Reference, and Practical Implementation
- BANKDB - Banking System Database
- BANK_USERS - User Management & Security for Bank System
- STUDENTDB - Student-Course Management System
- ESTOREDB - E-Commerce Shop Platform
- LibraryDB - Library Management System
- MyShopDB - Comprehensive E-Commerce Platform
SQL/
βββ oracle/
β βββ BANKDB.sql
β βββ BANK_USERS.sql
β βββ STUDENTDB.sql
β βββ README.md
β βββ bank_queries.sql
β
βββ mysql/
β βββ ESTOREDB.sql
β βββ README.md
β βββ estore_queries.sql
β
βββ mssql/
β βββ Library.sql
β βββ myshopdb.sql
β βββ README.md
β βββ shop_queries.sql
β
βββ docs/
β βββ LABS.md
β βββ ER_DIAGRAMS.md
β βββ SETUP_GUIDES.md
β
βββ README.md
βββ .gitignore
βββ LICENSE
Files: BANKDB.sql, BANK_USERS.sql
A complete banking database with user management, role-based access control, and comprehensive security implementation.
Features:
- Customer management
- Account management (Current, Saving, Deposit)
- Branch management
- Employee hierarchy with supervisor relationships
- User roles and privileges (BANKDBA, HR, Manager, Accountant, Clerks)
- Public synonyms for easy access
- Referential integrity constraints
Tables: customer, account, owner, branch, employee
Security: 7 user roles with granular permissions
File: STUDENTDB.sql
Academic management system for tracking students, courses, and results.
Features:
- Student information management
- Course catalog with credit hours
- Grade Point Average (GPA) tracking
- Composite primary keys for result tracking
- Sample queries with joins
Tables: STUDENT, COURSE, RESULT
File: ESTOREDB.sql
Modern e-commerce platform with advanced features including AI chatbot integration and analytics.
Features:
- Customer registration and authentication
- Product catalog with images and sizes
- Shopping cart and wishlist
- Order management with discount system
- Payment processing
- Shipping and billing
- AI-powered chat support with analytics
- Newsletter subscription
- Contact messaging system
Tables: 19 tables including customer, product, order, payment, chat_sessions, inventory, etc.
File: Library.sql
Simple and elegant library management system.
Features:
- Book catalog management
- Member registration
- Loan tracking
- Automated timestamps
Tables: Books, Members, Loans
File: myshopdb.sql
Enterprise-level e-commerce platform with comprehensive features.
Features:
- Admin and customer authentication
- Product management with reviews and images
- Multi-address support for customers
- Order workflow with status tracking
- Shopping cart and wishlist
- Contact message system with priority and status
- Extensive indexing for performance
Tables: 14 tables including Customers, Products, Orders, OrderDetails, ProductReviews, etc.
Depending on which database you want to use:
- Oracle Database (11g or higher) with SQL*Plus
- MySQL Server (5.7 or higher) or MariaDB
- MS SQL Server (2016 or higher) or SQL Server Express
- Clone the repository:
git clone https://github.com/yourusername/sql-database-scripts.git
cd sql-database-scripts- Choose your database system and navigate to the appropriate folder:
cd oracle/ # For Oracle scripts
cd mysql/ # For MySQL scripts
cd mssql/ # For MS SQL Server scripts- Execute the SQL scripts using your database client
-- Connect as SYSDBA
sqlplus sys/password as sysdba
-- Run the bank system scripts
@oracle/BANK_USERS.sql
@oracle/BANKDB.sql
-- Or run student database
@oracle/STUDENTDB.sql# Login to MySQL
mysql -u root -p
# Execute the script
source mysql/ESTOREDB.sql
# Or from command line
mysql -u root -p < mysql/ESTOREDB.sql-- Using SQL Server Management Studio (SSMS)
-- Open the .sql file and execute
-- Or using sqlcmd
sqlcmd -S localhost -U sa -P password -i mssql/Library.sql
sqlcmd -S localhost -U sa -P password -i mssql/myshopdb.sql- LABS.md - Detailed documentation of all lab exercises and coursework
- ER_DIAGRAMS.md - Entity-Relationship diagrams for each database
- SETUP_GUIDES.md - Platform-specific setup instructions
Each database folder contains:
- Schema creation scripts
- Sample data insertions
- Example queries (SELECT, JOIN, subqueries)
- Stored procedures and triggers (where applicable)
- Views and indexes
- Data Definition Language (DDL): CREATE, ALTER, DROP statements
- Data Manipulation Language (DML): INSERT, UPDATE, DELETE, SELECT
- Constraints: PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK, NOT NULL
- Relationships: One-to-One, One-to-Many, Many-to-Many
- Referential Integrity: CASCADE operations
- Security: User management, roles, and privileges
- Advanced Features: Triggers, stored procedures, views, indexes
- Transactions: COMMIT, ROLLBACK operations
Contributions are welcome! If you'd like to add more database scripts or improve existing ones:
- Fork the repository
- Create a new branch (
git checkout -b feature/new-database) - Commit your changes (
git commit -m 'Add new database schema') - Push to the branch (
git push origin feature/new-database) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Your Name
- GitHub: @ASAD2204
- Email: asadrafaqat2021@gmail.com
- Database course instructors and lab materials
- SQL community for best practices and patterns
- Contributors to this repository
β If you find this repository helpful, please consider giving it a star!
Last Updated: November 23, 2025