This document outlines all the laboratory exercises and practical work completed during the Database Management Systems course.
Course: Database Management Systems
Duration: Full Semester
Database Platforms: Oracle Database, MySQL, Microsoft SQL Server
Key Topics: DDL, DML, DCL, Constraints, Joins, User Management, Security
Objectives:
- Understand database creation
- Learn CREATE, DROP, and ALTER statements
- Practice data types and constraints
Database: STUDENTDB (Oracle)
Tasks Completed:
- ✅ Created STUDENT table with appropriate data types
- ✅ Created COURSE table with credit hour tracking
- ✅ Created RESULT table with composite primary key
- ✅ Implemented PRIMARY KEY constraints
- ✅ Implemented FOREIGN KEY constraints with referential integrity
- ✅ Added CHECK constraints for data validation
Key Concepts:
- Data Definition Language (DDL)
- Primary Keys and Foreign Keys
- Composite Keys
- Cascade Constraints
SQL Features Demonstrated:
-- Table creation with constraints
CREATE TABLE STUDENT (
STUDENT_ID VARCHAR2(10) NOT NULL,
STUDENT_NAME VARCHAR2(50) NOT NULL,
PRIMARY KEY (STUDENT_ID)
);
-- Composite primary key
ALTER TABLE RESULT
ADD CONSTRAINT RESULT_STUDENT_ID_COURSE_ID_CPK
PRIMARY KEY(STUDENT_ID, COURSE_ID);Objectives:
- Master INSERT, UPDATE, DELETE operations
- Understand transaction control
- Practice data manipulation
Database: STUDENTDB (Oracle)
Tasks Completed:
- ✅ Inserted sample student records
- ✅ Inserted course catalog data
- ✅ Created student enrollment records
- ✅ Performed UPDATE operations
- ✅ Queried data using SELECT statements
Key Concepts:
- INSERT statements
- UPDATE with WHERE clause
- SELECT queries
- Data integrity during operations
Objectives:
- Write multi-table queries
- Master different types of joins
- Use aliases for readability
Database: STUDENTDB, BANKDB (Oracle)
Tasks Completed:
- ✅ Performed INNER JOINs across multiple tables
- ✅ Created queries combining STUDENT, COURSE, and RESULT
- ✅ Used table aliases for cleaner queries
- ✅ Retrieved student grades with course information
Query Example:
SELECT S.STUDENT_ID, R.COURSE_ID, C.COURSE_NAME, R.GPA
FROM STUDENT S, COURSE C, RESULT R
WHERE S.STUDENT_ID = R.STUDENT_ID
AND R.COURSE_ID = C.COURSE_ID;Key Concepts:
- Table joins (implicit and explicit)
- WHERE clause for join conditions
- Column aliases
- Multi-table relationships
Objectives:
- Design a real-world banking system
- Implement complex relationships
- Handle self-referential foreign keys
Database: BANKDB (Oracle)
Tasks Completed:
- ✅ Designed 5-table banking schema
- ✅ Implemented customer and account management
- ✅ Created many-to-many relationship (owner table)
- ✅ Designed employee hierarchy with supervisor relationships
- ✅ Added CHECK constraint for account types
- ✅ Implemented CASCADE CONSTRAINTS
Tables Created:
customer- Customer informationaccount- Bank accounts (current, saving, deposit)owner- Customer-Account relationshipbranch- Branch detailsemployee- Employee hierarchy
Advanced Features:
-- Self-referential foreign key
ALTER TABLE employee
ADD CONSTRAINT employee_supervisor_FK
FOREIGN KEY(supervisor) REFERENCES employee(staffNO);
-- CHECK constraint for business rules
ALTER TABLE account
ADD CONSTRAINT account_type_chk
CHECK (type IN ('current','saving','deposit'));Key Concepts:
- Self-referential relationships
- Many-to-many relationships
- Business rule constraints
- Hierarchical data modeling
Objectives:
- Create and manage database users
- Implement role-based access control
- Practice privilege management
Database: BANK_USERS (Oracle)
Tasks Completed:
- ✅ Connected as SYSDBA
- ✅ Created power user (BANKDBA) with DBA privileges
- ✅ Created departmental users (BANK_HR, MANAGER, ACCOUNTANT)
- ✅ Created operational users (6 clerks)
- ✅ Granted system privileges (CREATE SESSION, CREATE TABLE, etc.)
- ✅ Granted object privileges on tables
- ✅ Used WITH ADMIN OPTION and WITH GRANT OPTION
- ✅ Created PUBLIC SYNONYMS
User Hierarchy Implemented:
SYS (SYSDBA)
└── BANKDBA (DBA)
├── BANK_HR
│ ├── CLERK_A (Full access to employee)
│ └── CLERK_B (Read-only employee)
├── MANAGER
│ ├── CLERK_C (Customer operations)
│ └── CLERK_D (Branch operations)
└── ACCOUNTANT
├── CLERK_E (Account operations)
└── CLERK_F (Customer financial ops)
Security Concepts:
-- System privileges
GRANT CONNECT, CREATE SESSION, CREATE TABLE TO BANK_HR
WITH ADMIN OPTION;
-- Object privileges
GRANT SELECT, INSERT, UPDATE, DELETE ON employee TO BANK_HR
WITH GRANT OPTION;
-- Public synonyms for transparency
CREATE PUBLIC SYNONYM customer FOR BANKDBA.customer;Key Concepts:
- Data Control Language (DCL)
- User creation and authentication
- System vs. Object privileges
- WITH ADMIN OPTION vs. WITH GRANT OPTION
- Role delegation
- Public synonyms
Objectives:
- Work with MySQL-specific features
- Design comprehensive e-commerce system
- Implement BLOB storage
Database: ESTOREDB (MySQL)
Tasks Completed:
- ✅ Created 19-table e-commerce platform
- ✅ Implemented AUTO_INCREMENT primary keys
- ✅ Designed product catalog with images
- ✅ Created order management system with discounts
- ✅ Implemented AI chatbot integration
- ✅ Added analytics tables for business intelligence
- ✅ Created wishlist and shopping cart functionality
- ✅ Designed multi-image product support
Advanced Features:
- BLOB storage for images
- InnoDB engine for ACID compliance
- ENUM types for status fields
- Composite indexes for performance
- CASCADE operations
- DEFAULT values with functions (CURRENT_TIMESTAMP)
MySQL-Specific Syntax:
-- AUTO_INCREMENT
CREATE TABLE product (
product_id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (product_id)
) ENGINE=InnoDB;
-- ENUM type
session_type ENUM('customer','admin') DEFAULT 'customer'
-- Composite index
KEY idx_session_created (session_id, created_at)Key Concepts:
- MySQL storage engines
- AUTO_INCREMENT vs. IDENTITY
- BLOB vs. filesystem storage
- UTF8MB4 character set
- Indexing strategies
Objectives:
- Learn SQL Server syntax and features
- Practice with identity columns
- Understand SQL Server data types
Database: LibraryDB (MS SQL Server)
Tasks Completed:
- ✅ Created database with SQL Server-specific settings
- ✅ Implemented IDENTITY columns
- ✅ Used NVARCHAR for Unicode support
- ✅ Created foreign keys with constraint names
- ✅ Set default values using GETDATE()
- ✅ Configured clustered indexes
SQL Server Features:
-- IDENTITY column
CREATE TABLE Books (
Id INT IDENTITY(1,1) NOT NULL,
PRIMARY KEY CLUSTERED (Id)
);
-- Default constraint
[LoanDate] DATETIME DEFAULT (GETDATE())
-- Unicode data types
[Title] NVARCHAR(200) NOT NULLKey Concepts:
- IDENTITY vs. AUTO_INCREMENT
- NVARCHAR for international characters
- Clustered vs. Non-clustered indexes
- SQL Server system functions
- Database compatibility levels
Objectives:
- Build enterprise-grade e-commerce system
- Implement computed columns
- Create comprehensive indexing strategy
Database: MyShopDB (MS SQL Server)
Tasks Completed:
- ✅ Created 14-table e-commerce system
- ✅ Implemented admin and customer authentication
- ✅ Designed product catalog with reviews and ratings
- ✅ Created order workflow with status tracking
- ✅ Implemented shopping cart and wishlist
- ✅ Added contact messaging system
- ✅ Created multiple address support
- ✅ Implemented computed columns
- ✅ Added extensive indexing (20+ indexes)
Advanced Features:
-- Computed column
[TotalPrice] AS ([Quantity] * [UnitPrice]) PERSISTED
-- CHECK constraint with range
CHECK (([Rating] >= 1 AND [Rating] <= 5))
-- Composite unique constraint
CONSTRAINT UK_Cart_Customer_Product UNIQUE (CustomerId, ProductId)
-- Conditional default
[Status] NVARCHAR(50) DEFAULT 'New'Indexing Strategy:
- Clustered indexes on PKs
- Non-clustered on FKs
- Indexes on frequently queried columns (Email, Username)
- Composite indexes for common queries
- Unique indexes for business rules
Key Concepts:
- Computed columns (PERSISTED)
- DATETIME2 for precision
- Extensive indexing for performance
- Audit fields (CreatedAt, ModifiedAt)
- Soft deletes with IsActive flags
- Priority and status enumerations
Labs: 1, 2, 3, 4, 5
Scripts: STUDENTDB.sql, BANKDB.sql, BANK_USERS.sql
Key Features Learned:
- SQL*Plus command line
- VARCHAR2 data type
- CASCADE CONSTRAINTS syntax
- User management with GRANT/REVOKE
- Public synonyms
- / for statement termination
Labs: 6
Scripts: ESTOREDB.sql
Key Features Learned:
- AUTO_INCREMENT
- InnoDB storage engine
- ENUM and SET types
- BLOB storage
- Backtick identifiers
- IF NOT EXISTS syntax
- UTF8MB4 character set
Labs: 7, 8
Scripts: Library.sql, myshopdb.sql
Key Features Learned:
- IDENTITY columns
- NVARCHAR for Unicode
- DATETIME2 precision
- Computed columns
- Query Store
- Clustered indexes
- GO batch separator
- Square bracket identifiers
By completing these labs, students have learned:
- ✅ Entity-Relationship modeling
- ✅ Normalization (1NF, 2NF, 3NF)
- ✅ Primary and foreign key selection
- ✅ Relationship types (1:1, 1:N, M:N)
- ✅ Self-referential relationships
- ✅ Composite keys
- ✅ DDL (CREATE, ALTER, DROP)
- ✅ DML (SELECT, INSERT, UPDATE, DELETE)
- ✅ DCL (GRANT, REVOKE)
- ✅ Constraints (PK, FK, CHECK, UNIQUE, NOT NULL)
- ✅ Joins (INNER, LEFT, RIGHT, FULL)
- ✅ Aggregate functions
- ✅ Subqueries
- ✅ Indexes
- ✅ User creation and management
- ✅ Privilege assignment
- ✅ Role-based access control
- ✅ WITH GRANT OPTION
- ✅ Public synonyms
- ✅ Schema separation
- ✅ Oracle SQL*Plus
- ✅ MySQL command line and Workbench
- ✅ SQL Server Management Studio (SSMS)
- ✅ Platform syntax differences
- ✅ Data type variations
- ✅ Auto-increment mechanisms
- ✅ Banking systems
- ✅ E-commerce platforms
- ✅ Library management
- ✅ Student information systems
- ✅ Inventory tracking
- ✅ Order processing
- ✅ User authentication
- ✅ Naming conventions
- ✅ Referential integrity
- ✅ Data validation
- ✅ Performance optimization
- ✅ Index strategy
- ✅ Backup and recovery concepts
- ✅ Documentation
| Metric | Count |
|---|---|
| Total Labs | 8 |
| Databases Created | 6 |
| Total Tables | 50+ |
| Database Platforms | 3 |
| Users Created | 9 |
| Constraints Implemented | 100+ |
| Sample Queries Written | 50+ |
| Lines of SQL Code | 2000+ |
- Implicit vs. explicit transactions
- COMMIT and ROLLBACK operations
- Transaction isolation levels
- Index selection and creation
- Query execution plans
- Avoiding full table scans
- Statistics management
- Entity integrity (Primary Keys)
- Referential integrity (Foreign Keys)
- Domain integrity (CHECK, data types)
- User-defined integrity (triggers, procedures)
- BLOB storage for images
- JSON support (modern versions)
- Full-text search
- Computed columns
- Analytics and BI integration
- Oracle Database Concepts Guide
- MySQL Reference Manual
- SQL Server Books Online
- SQL Fundamentals textbook
- Additional queries in
*_queries.sqlfiles - ERD practice in
/docs/ER_DIAGRAMS.md - Setup guides in
/docs/SETUP_GUIDES.md
- Stored procedures and functions
- Triggers for automated actions
- Views for data abstraction
- Database administration
- Performance tuning
- Replication and high availability
- Create databases and tables
- Define constraints and relationships
- Insert and manipulate data
- Write complex queries with joins
- Implement user security
- Design normalized schemas
- Work with three major DBMS platforms
- Optimize queries with indexes
- Handle hierarchical data
- Implement business logic in database
- Work with BLOBs and large objects
- Create and manage transactions
- Design real-world applications
Course Completed: November 2025
Total Hours: 120+ hours of practical work
Proficiency Level: Intermediate to Advanced
This documentation serves as a comprehensive record of all practical database work completed during the course.