This folder contains all SQL scripts required to build, populate, and test the University Database for CS4222.
Creates all base tables in the database:
departmentprofessorstudentprojectworks_on_co_pisworks_on_grad_students
Includes:
- primary keys
- foreign keys
- NOT NULL constraints
- reference rules (ON DELETE RESTRICT)
Inserts sample data into all tables:
- Departments
- Professors
- Students (with advisor assignment)
- Projects (with PI assignment)
- Co-PI assignments
- Graduate student project assignments
This data matches the data used in our Java tests and screenshots.
Contains trigger functions and triggers for:
Ensures each project has at most 4 co-PIs.
Ensures each graduate student works on no more than 2 projects.
Both triggers were fully tested (screenshots included in /docs and Canvas submission).
Contains stored functions:
Returns the percentage of female faculty in the university.
Returns total number of people working on a project, counting:
- PI
- Co-PIs
- Graduate students (RAs)
Both stored procedures were tested and their results included in the project documentation.
Run the files in this order on the CSULA PostgreSQL remote server:
\i create_tables.sql
\i sample_data.sql
\i triggers.sql
\i procedures.sql