Project Overview
This capstone project brings together everything you have learned about file handling, structures, and data management in C. You will work with the NED University Student Academic Records dataset from Kaggle containing 3,500+ student records with fields including student ID, roll number, department, batch year, and 20,000+ GPA results across 14 semesters. Your goal is to build a professional-grade database management system that handles persistent storage using binary files, implements efficient search and sort algorithms, and provides a user-friendly command-line interface for all CRUD operations.
Structures
Design data structures for student records and courses
File I/O
Binary and text file handling for persistent storage
Algorithms
Search and sort algorithms for data retrieval
CLI Interface
Menu-driven command-line user interface
Learning Objectives
Technical Skills
- Design and implement complex structures with nested types
- Master binary file I/O with fread() and fwrite()
- Implement efficient search algorithms (linear, binary)
- Apply sorting algorithms to structure arrays
- Build modular programs with header files
Professional Skills
- Design database schemas and data models
- Implement data validation and error handling
- Create user-friendly command-line interfaces
- Write maintainable and well-documented code
- Test with edge cases and handle errors gracefully
Project Scenario
TechVarsity University
You have been hired as a Software Developer at TechVarsity University, a growing educational institution with over 500 enrolled students across multiple departments. The registrar's office currently manages student records using spreadsheets, which has become unmanageable as the student body grows. The IT department needs a robust, command-line based student database system that can be deployed on the university's Linux servers.
"We need a reliable system to manage student records - add new students, update their information, track their courses and grades, and generate reports. The system must store data persistently and be fast enough to search through hundreds of records instantly. Can you build this for us?"
System Requirements from the Client
- Add new student records with validation
- View individual student details
- Update student information
- Delete student records (with confirmation)
- Search by student ID (exact match)
- Search by name (partial match)
- Filter by department or status
- Filter by GPA range
- Sort by name, ID, GPA, or enrollment date
- List all students (paginated)
- Generate department-wise statistics
- Export data to CSV format
- Store all records in binary file
- Auto-save after each modification
- Backup and restore functionality
- Import from CSV file
The Dataset
You will work with a comprehensive relational student database from Kaggle. Download the 4 CSV files containing student records, results, departments, and semesters to test your implementation:
Dataset Download
Download the sample dataset files based on the NED University Student Academic Records structure. Contains 4 relational CSV files with foreign key relationships.
Full Dataset from Kaggle
This project is based on the NED University Student Academic Records (2018-25) dataset from Kaggle. For the complete dataset with 3,500+ students and 20,000+ results, download from Kaggle:
Dataset Schema
departments (1) ──< students (N)
│
└──< results (N) >── semesters (1)
| Column | Type | Description |
|---|---|---|
id | Integer | Primary Key - Unique student identifier |
roll_number | String | Unique roll number (e.g., CS-21001) |
department_id | Integer | Foreign Key → departments.id |
batch_year | Integer | Year of admission (2018-2023) |
| Column | Type | Description |
|---|---|---|
id | Integer | Result record identifier |
student_id | Integer | Foreign Key → students.id |
semester_id | Integer | Foreign Key → semesters.id |
gpa | Float | GPA for semester (0.00-4.00) |
semester_num | Integer | Progressive semester number (1, 2, 3...) |
| Column | Type | Description |
|---|---|---|
id | Integer | Primary Key - Department identifier |
name | String | Full department name (e.g., "Computer Science") |
code | String | Department code (e.g., "CS", "SE", "AI") |
| Column | Type | Description |
|---|---|---|
id | Integer | Primary Key - Semester identifier |
year | Integer | Academic year (e.g., 2021, 2022) |
session | String | Session type ("Spring" or "Fall") |
Sample Data Preview
Here is sample data from each of the 4 relational tables:
students.csv
| id | roll_number | department_id | batch_year |
|---|---|---|---|
| 1 | CS-18001 | 1 | 2018 |
| 36 | CS-21001 | 1 | 2021 |
| 47 | AI-21001 | 4 | 2021 |
results.csv
| id | student_id | semester_id | gpa | semester_num |
|---|---|---|---|---|
| 1 | 1 | 1 | 3.45 | 1 |
| 65 | 36 | 7 | 3.72 | 1 |
| 66 | 36 | 8 | 3.78 | 2 |
departments.csv
| id | name | code |
|---|---|---|
| 1 | Computer Science | CS |
| 2 | Software Engineering | SE |
| 4 | Artificial Intelligence | AI |
semesters.csv
| id | year | session |
|---|---|---|
| 1 | 2018 | Fall |
| 7 | 2021 | Fall |
| 14 | 2025 | Spring |
Key Concepts
Before diving into the implementation, understand these fundamental concepts that power your student database system. These concepts are essential for building a robust and efficient data management application.
- Date Structure: Store day, month, year components
- Student Structure: 13 fields including ID, name, email, phone, DOB, gender, department, enrollment date, GPA, credits, status, address
- StudentDB Structure: Dynamic array, count, capacity, filename
- Memory Management: Dynamic allocation with malloc/realloc
- Array Expansion: Double capacity when full
- Proper Cleanup: Free all allocated memory on exit
- Binary Write: fwrite() for structures to .dat file
- Binary Read: fread() to load records from .dat file
- CSV Import: Parse comma-separated values with validation
- CSV Export: Generate properly formatted CSV output
- Backup System: Create timestamped backup copies
- Error Handling: Check file operations for failures
- Binary Search: O(log n) lookup by student ID (requires sorted data)
- Linear Search: Name search with partial matching
- Filter Functions: By department, GPA range, status
- Case-Insensitive: Match regardless of capitalization
- Multiple Results: Return array of matching records
- Efficient Indexing: Maintain sorted order for fast lookups
- qsort() Function: Standard library quicksort
- Comparator Functions: Custom compare for each field
- Sort by ID: Numeric ascending/descending
- Sort by Name: Alphabetical by last name, first name
- Sort by GPA: Highest to lowest ranking
- Sort by Date: Chronological enrollment order
Project Structure
include/
- student.h - Structure definitions
- database.h - Database operations
- fileio.h - File I/O functions
- search.h - Search and sort
- menu.h - Menu interface
src/
- student.c - CRUD operations
- database.c - DB management
- fileio.c - Read/write operations
- search.c - Search algorithms
- menu.c - User interface
- main.c - Entry point
Other Files
- data/ - Sample CSV data
- tests/ - Unit test files
- Makefile - Build config
- README.md - Documentation
Project Requirements
Complete all components below to build a fully functional student database system. Each step builds upon the previous one, taking you from basic data structures to a complete interactive application.
Data Structures
Structure Definitions (student.h):
- Define
Datestructure for date handling - Define
Studentstructure with all 13 fields - Define
StudentDBstructure for database management - Define constants: MAX_STUDENTS, MAX_NAME_LEN, etc.
Validation Functions (student.c):
validate_student()- Check all fields are validvalidate_email()- Email format validationvalidate_gpa()- GPA in range 0.0-4.0validate_date()- Date is valid and reasonable
File I/O Operations
Binary File Operations (fileio.c):
save_database()- Write all records to binary fileload_database()- Read all records from binary filebackup_database()- Create timestamped backup copyrestore_database()- Restore from backup file
CSV Import/Export (fileio.c):
import_from_csv()- Parse CSV and add recordsexport_to_csv()- Export all records as CSV- Handle quoted fields, escaped commas, and newlines
- Report import errors with line numbers
CRUD Operations
Create Operations (database.c):
db_init()- Initialize empty databasedb_add_student()- Add new student with validation- Generate unique student ID if not provided
- Auto-expand array when capacity is reached
Read Operations (database.c):
db_get_by_id()- Get student by IDdb_get_all()- Get all students (paginated)db_count()- Get total student countdb_get_by_department()- Filter by department
Update and Delete (database.c):
db_update_student()- Update existing recorddb_delete_student()- Remove record by IDdb_free()- Free all allocated memory
Search and Sort
Search Algorithms (search.c):
search_by_id()- Binary search by student IDsearch_by_name()- Partial match name searchsearch_by_email()- Exact email matchfilter_by_gpa_range()- Filter by GPA min/maxfilter_by_status()- Filter by enrollment status
Sort Algorithms (search.c):
sort_by_id()- Sort ascending/descending by IDsort_by_name()- Alphabetical sort by last namesort_by_gpa()- Sort by GPA (highest first)sort_by_date()- Sort by enrollment date- Use qsort() with custom comparator functions
Menu Interface
Main Menu (menu.c):
- Display numbered menu options
- Read user choice with input validation
- Clear screen between operations (optional)
- Handle invalid input gracefully
Menu Options (11 items): Add, View, Search, Update, Delete, List All, Sort, Reports, Import CSV, Export CSV, Backup, Exit
Sub-menus:
- Search menu: By ID, name, department, GPA range, status
- Sort menu: By ID, name, GPA, enrollment date
- Report menu: Department statistics, GPA distribution
Reports and Statistics
Statistics Functions:
report_total_count()- Total studentsreport_by_department()- Count per departmentreport_by_status()- Count by statusreport_gpa_stats()- Avg, min, max GPAreport_gpa_distribution()- GPA ranges histogram
Output Format: Clear tabular display with headers, aligned columns, totals, and averages. Include department names, student counts, and calculated GPA statistics.
Example Usage
Your student database system should provide a clear, menu-driven interface. Below are the expected features and sample workflows for each major operation.
- Add New Student
- View Student by ID
- Search Students
- Update Student
- Delete Student
- List All Students
- Sort Students
- Generate Report
- Import from CSV
- Export to CSV
- Backup Database
- Exit
When viewing a student, display:
- Student ID and Full Name
- Email and Phone Number
- Date of Birth and Gender
- Department Name
- Enrollment Date
- Current GPA and Credits Completed
- Enrollment Status
- Full Address
- Search by ID: Exact match, instant result
- Search by Name: Partial match, multiple results
- Search by Department: List all in department
- Filter by GPA Range: Min and max GPA input
- Filter by Status: Active, Graduated, On Leave, Suspended
- Department Statistics: Count and avg GPA per dept
- GPA Distribution: Histogram of GPA ranges
- Status Summary: Count by enrollment status
- Top 10 Students: Highest GPA ranking
Test Cases for Validation
| Operation | Input | Expected Result |
|---|---|---|
| Add Student | Valid data | New ID assigned, record saved |
| Add Student | Duplicate ID | Error: ID already exists |
| Add Student | Invalid email | Error: Invalid email format |
| Add Student | GPA = 4.5 | Error: GPA must be 0.0-4.0 |
| Search by ID | 10001 | Emily Johnson record displayed |
| Search by ID | 99999 | Error: Student not found |
| Search by name | "john" | All students with "john" in name |
| Filter GPA | 3.5 to 4.0 | List of honor students |
| Delete | 10001 + confirm | Record deleted, auto-save |
| Delete | 10001 + cancel | No change, operation cancelled |
| Export CSV | output.csv | All records exported |
| Import CSV | students.csv | 500 records imported |
Submission Requirements
Create a public GitHub repository with the exact name shown below:
Required Repository Name
c-student-database
Required Project Structure
include/
- student.h
- database.h
- fileio.h
- search.h
- menu.h
src/
- student.c
- database.c
- fileio.c
- search.c
- menu.c
- main.c
Other
- data/ (students.csv)
- tests/ (test files)
- Makefile
- README.md
README.md Required Sections
1. Project Header
- Project title and description
- Your full name and submission date
- Course and project number
2. Features
- List of all CRUD operations
- Search and sort capabilities
- File I/O features (binary, CSV)
3. Build Instructions
- Prerequisites (GCC, make)
- How to compile with make
- How to run the program
4. Usage Examples
- Menu navigation guide
- Sample operations with output
- Screenshots of terminal output
5. Data Structures
- Student structure description
- Database structure description
- File format documentation
6. Testing
- How to run test cases
- Test coverage description
- Edge cases handled
7. Challenges and Solutions
- Difficulties encountered
- How you solved them
- What you learned
8. Contact
- GitHub profile link
- LinkedIn (optional)
- Email (optional)
Do Include
- All source files (.c) and headers (.h)
- Working Makefile with all targets
- Sample data file (students.csv)
- Test file with unit tests
- Screenshots showing functionality
- Complete README with all sections
Do Not Include
- Compiled binaries or object files (*.o, *.exe)
- Binary database files (*.dat)
- IDE-specific files (.vscode/, .idea/)
- Temporary or backup files
- Plagiarized code from online sources
gcc -Wall -Wextra and all
menu operations work correctly. Test with valgrind to ensure no memory leaks.
Enter your GitHub username - we will verify your repository automatically
Grading Rubric
Your project will be graded on the following criteria. Total: 450 points.
| Criteria | Points | Description |
|---|---|---|
| Data Structures | 50 | Proper structure design, validation functions, memory management |
| File I/O | 75 | Binary file operations, CSV import/export, backup/restore |
| CRUD Operations | 100 | All create, read, update, delete operations working correctly |
| Search and Sort | 75 | Multiple search methods, sorting by different fields |
| User Interface | 50 | Menu system, input validation, user-friendly messages |
| Reports | 50 | Statistics, formatted output, department reports |
| Code Quality | 25 | Modular design, comments, no memory leaks, warnings |
| Documentation | 25 | README quality, screenshots, build instructions |
| Total | 450 |
Grading Levels
Excellent
Exceeds all requirements with exceptional quality
Good
Meets all requirements with good quality
Satisfactory
Meets minimum requirements
Needs Work
Missing key requirements
Ready to Submit?
Make sure you have completed all requirements and reviewed the grading rubric above.
Submit Your ProjectPre-Submission Checklist
Use this checklist to verify you have completed all requirements before submitting your project.
Data Structures
File I/O
CRUD Operations
Repository Requirements
Common Issues and Solutions
Encountering problems? Here are the most common issues students face and how to resolve them quickly.
Segmentation Fault on Load
Program crashes when loading database file
Ensure you allocate memory before reading records:
db->students = malloc(db->count * sizeof(Student));
CSV Parsing Errors
Names with commas break CSV parsing
Handle quoted fields properly. If a field starts with a quote, read until closing quote:
if (line[i] == '"') { /* Read until next quote */ }
Binary Search Not Finding Records
Binary search returns NULL even for existing records
Binary search requires sorted data. Sort by ID before searching:
qsort(db->students, db->count, sizeof(Student), compare_by_id);
Input Buffer Issues
scanf() skips input or leaves newline in buffer
Clear input buffer after scanf() or use fgets() for strings:
while (getchar() != '\n'); // Clear buffer
Still Having Issues?
Check the course discussion forum or reach out for help