COMP3311 25T2 Assignment 2
Example Test Cases
Database Systems
Last updated: Saturday 26th July 2025 11:55pm
Most recent changes are shown in red ... older changes are shown in brown.

[Assignment Spec]  [SQL Schema]   [SQL Data]   [Grades+Rules]   [Examples]   [Testing]   [Submitting]


Introduction

This document contains examples of output from the various scripts that you are required to develop.

  1. Q1 Examples
  2. Q2 Examples
  3. Q3 Examples
  4. Q4 Examples
  5. Q5 Examples



Q1

$ python3 q1.py
Faculty                                 #Schools #Staff
College of Fine Arts (COFA)                    0      0
Faculty of Arts and Social Sciences            0      1
Faculty of Arts, Design and Architecture       8    409
Faculty of Built Environment                   0      5
Faculty of Engineering                         8    411
Faculty of Law and Justice                     4      8
Faculty of Medicine and Health                 6     87
Faculty of Science                             8    255
UNSW Business School                           9    379
UNSW College                                   0      3

Q2

$ python3 q2.py COMP3311 
COMP3311 (Database Systems):
22T1(70.77) -> 22T3(72.00)
$ python3 q2.py MATH1081
MATH1081 (Discrete Mathematics):
22T2(58.61) -> 22T3(59.92) -> 23T1(61.22) -> 23T2(64.56)
$ python3 q2.py COMPCOMP
Subject COMPCOMP not found.
$ python3 q2.py comp3311
Subject comp3311 not found.
$ python3 q2.py MATH1151
No increasing run found for MATH1151.

Q3

$ python3 q3.py 3892140
3892140 Burn, Farid (Domestic student from Australia)
8338 Engineering Science (ELECIS)
GSOE9830 20T2 Economic Decision Analysis in Engineerin 57 PS   6uoc
ELEC9713 21T1 Industrial and Commercial Power Systems  42 FL   fail
Total achieved UOC = 6, WAM = 49.500
DEBUG: Weighted_sum:594 UOC_for_WAM:12, UOC_passed:6

$ python3 q3.py 5893146
5893146 Aung, Timothy Russell (Domestic student from Australia)
3778 Computer Science (COMPA1)
ACCT1501 20T1 Accounting and Financial Management 1A   93 HD   6uoc
COMP1511 20T1 Programming Fundamentals                  - SY   6uoc
MATH1141 20T1 Higher Mathematics 1A                     - SY   6uoc
COMP1521 20T2 Computer Systems Fundamentals            55 UF   fail
ECON1101 20T2 Microeconomics 1                         85 HD   6uoc
MATH1231 20T2 Mathematics 1B                           74 CR   6uoc
COMP2521 20T3 Data Structures and Algorithms           86 HD   6uoc
MATH1081 20T3 Discrete Mathematics                     79 DN   6uoc
COMP3311 21T1 Database Systems                         88 HD   6uoc
ECON1102 21T1 Macroeconomics 1                         68 CR   6uoc
MGMT1001 21T1 Managing Organisations and People        76 DN   6uoc
COMP1521 21T2 Computer Systems Fundamentals            85 HD   6uoc
PSYC1001 21T2 Psychology 1A                            71 CR   6uoc
COMP3331 21T3 Computer Networks and Applications       64 PS   6uoc
COMP1531 22T1 Software Engineering Fundamentals        92 HD   6uoc
COMP3121 22T1 Algorithms and Programming Techniques    69 CR   6uoc
COMP3411 22T1 Artificial Intelligence                  72 CR   6uoc
ARTS1270 22T2 Global History: Exploring the First Glob  - AW   unrs
COMP2511 22T2 Object-Oriented Design and Programming   68 CR   6uoc
COMP3421 22T3 Computer Graphics                        65 CR   6uoc
COMP4920 22T3 Management and Ethics                    84 DN   6uoc
COMP3231 23T1 Operating Systems                        66 CR   6uoc
COMP6080 23T1 Web Front-end Programming                76 DN   6uoc
DDES1110 23T1 3D Visualisation 1 - 3D Virtual Objects  67 CR   6uoc
COMP3900 23T2 Computer Science Project                 97 HD   6uoc
COMP9313 23T2 Big Data Management                      80 DN   6uoc
Total achieved UOC = 144, WAM = 76.522

$ python3 q3.py 5895425
5895425 Li, Ke (International student from China)
9313 Design (DESGBS)
ADAD9312 23T3 Leadership in the Cultural and Creative   -  -
SDES9204 23T3 Design Studio: Insight, Processes and Co  -  -
SDES9760 23T3 Introduction to Graphics Media            -  -
Total achieved UOC = 0, Can't compute WAM

$ python3 q3.py 1234567
No one has the zID 1234567.

$ python3 q3.py 9890898
9890898 Burton, Grace is a staff member, and not a student.

$ python3 q3.py 5894089
5894089 Liao, Ruisi (Domestic student from China)
3781 Advanced Mathematics (Honours) / Computer Science (COMPA1 and MATHA1)
COMP1511 20T1 Programming Fundamentals                  - SY   6uoc
MATH1141 20T1 Higher Mathematics 1A                     - SY   6uoc
SCIF1131 20T1 Introductory Skills for Science           - SY   6uoc
MATH1081 20T2 Discrete Mathematics                    100 HD   6uoc
MATH1241 20T2 Higher Mathematics 1B                    69 CR   6uoc
ACCT1501 20T3 Accounting and Financial Management 1A   73 CR   6uoc
ECON1101 20T3 Microeconomics 1                         65 CR   6uoc
MATH2111 21T1 Higher Several Variable Calculus         69 CR   6uoc
MATH2301 21T1 Mathematical Computing                   79 DN   6uoc
MATH2221 21T2 Higher Theory and Applications of Differ 70 CR   6uoc
MATH2601 21T2 Higher Linear Algebra                    56 PS   6uoc
MATH2901 21T2 Higher Theory of Statistics              68 CR   6uoc
MATH2621 21T3 Higher Complex Analysis                  80 DN   6uoc
MATH2831 21T3 Linear Models                            74 CR   6uoc
MATH3411 21T3 Information, Codes and Ciphers           82 DN   6uoc
ARTS1630 22T1 Introductory Japanese A                  89 HD   6uoc
MATH3161 22T1 Optimisation                             87 HD   6uoc
ARTS1660 22T2 Introductory Korean A                    81 DN   6uoc
MATH3311 22T2 Mathematical Computing for Finance       73 CR   6uoc
MATH3191 22T3 Mathematical Optimization for Data Scien 94 HD   6uoc
MATH3871 22T3 Bayesian Inference and Computation       93 HD   6uoc
PHYS1160 22T3 Introduction to Astronomy                99 HD   6uoc
ECON1102 23T0 Macroeconomics 1                         56 PS   6uoc
SCIF1004 23T0 Science and the Cinema                   98 HD   6uoc
Total achieved UOC = 144, WAM = 78.810

Q4

$ python3 q4.py "uoc:>=6 && <12;
career:!('PG');
title:'math' && !(' 1A' || 'Comp');
code:'10' && ('2' || '3' || '4')"
Code      Title                                                    UoC    Career
DPST1014  Mathematics 1B                                             6      UGRD
MATH1031  Mathematics for Life Sciences                              6      UGRD

$ python3 q4.py "uoc:>=6 && <12; career:!('PG'); title:'data'; code:'comp'"
Code      Title                                                    UoC    Career
COMP1000  Introduction to World Wide Web, Spreadsheets and Dat...    6      UGRD
COMP2521  Data Structures and Algorithms                             6      UGRD
COMP3311  Database Systems                                           6      UGRD
COMP4336  Mobile Data Networking                                     6      UGRD
COMP9315  Database Systems Implementation                            6      UGRD

$ python3 q4.py "uoc : = 6; career: 'p';  title:'data science'"
Code      Title                                                    UoC    Career
DATA5011  Data Science and Decisions Project A                       6      PGRD
DATA5012  Data Science and Decisions Project B                       6      PGRD
DATA9001  Fundamentals of Data Science                               6      PGRD
HDAT9100  Context of Health Data Science                             6      PGRD
HDAT9200  Statistical Foundations for Health Data Science            6      PGRD
HDAT9300  Computing for Health Data Science                          6      PGRD
HDAT9900  Health Data Science: Dissertation (6 Units of Credit)      6      PGRD
HDAT9910  Health Data Science: Capstone                              6      PGRD
MATH5191  Mathematical Optimization for Data Science                 6      PGRD
MATH5271  Environmental Data Science and Statistics                  6      PGRD

$ python3 q4.py ""
Error: No filter conditions provided

$ python3 q4.py "code:'3311';title 'data'"
Error: missing a ":" in "title 'data'"

$ python3 q4.py "uoc : <6; career: 'P';  name:'data science'"
Error: Unknown field "name"

$ python3 q4.py "uoc : =6 &&; career: 'U';  aaaaa:'data science'"
Error: The "uoc" expression is not evaluable

$ python3 q4.py "uoc : ! = 6 && = 6"
There are no subjects that match the conditions

$ python3 q4.py "uoc: < = 2"
Error: The "uoc" expression is not evaluable

$ python3 q4.py "uoc: ='12';   title: 'mATh'"
python3 q4.py "uoc: ='12';   title: 'mATh'"
Code      Title                                                    UoC    Career
MATH2199  Advanced Mathematics Industrial Placement 2 (Co-Op)       12      UGRD
MATH3199  Advanced Mathematics Industrial Placement 3B (Co-Op)      12      UGRD
MATH4002  Mathematics and Statistics Honours Thesis B               12      UGRD
Error: The "uoc" expression is not evaluable


$ python3 q4.py " uoc   :    >       18"
Code      Title                                                    UoC    Career
EXCH7002  Built Environment Exchange Program                        24      PGRD
EXCH7003  College of Fine Arts Exchange Program                     24      PGRD
EXCH7004  Commerce and Economics Exchange Program                   24      PGRD
EXCH7005  Engineering Exchange Program                              24      PGRD
EXCH7006  Law Exchange Program                                      24      PGRD
EXCH8001  Arts and Social Sciences Exchange Program                 24      UGRD
EXCH8002  Built Environment Exchange Program                        24      UGRD
EXCH8003  Art and Design Exchange Program                           24      UGRD
EXCH8004  Business Exchange Program                                 24      UGRD
EXCH8005  Engineering Exchange Program                              24      UGRD
EXCH8006  Law Exchange Program                                      24      UGRD
EXCH8008  Science Exchange Program                                  24      UGRD
EXCH8010  International Studies Exchange Program                    24      UGRD
MNGT5588  Extension Research Project 24 Units of Credit             24      PGRD
MNGT5592  Work Integrated Learning 24 Units of Credit               24      PGRD
PLAN0082  Work Experience                                           24      UGRD
SAED4491  Professional Experience Internship                        24      UGRD
SOMS4001  School of Medical Sciences Honours (Full Time)            24      UGRD

Q5

$ python3 q5.py 5893146
5893146 Aung, Timothy Russell
3778 COMPA1 Computer Science
ACCT1501 20T1 Accounting and Financial Management 1A   93 HD   6uoc  General Education
COMP1511 20T1 Programming Fundamentals                  - SY   6uoc  Foundational Computing
MATH1141 20T1 Higher Mathematics 1A                     - SY   6uoc  Comp Sci Maths
COMP1521 20T2 Computer Systems Fundamentals            55 UF   fail
ECON1101 20T2 Microeconomics 1                         85 HD   6uoc  General Education
MATH1231 20T2 Mathematics 1B                           74 CR   6uoc  Comp Sci Maths
COMP2521 20T3 Data Structures and Algorithms           86 HD   6uoc  Foundational Computing
MATH1081 20T3 Discrete Mathematics                     79 DN   6uoc  Comp Sci Maths
COMP3311 21T1 Database Systems                         88 HD   6uoc  COMPA1 Computing Electives
ECON1102 21T1 Macroeconomics 1                         68 CR   6uoc  COMPA1 Free Electives
MGMT1001 21T1 Managing Organisations and People        76 DN   6uoc  COMPA1 Free Electives
COMP1521 21T2 Computer Systems Fundamentals            85 HD   6uoc  Foundational Computing
PSYC1001 21T2 Psychology 1A                            71 CR   6uoc  COMPA1 Free Electives
COMP3331 21T3 Computer Networks and Applications       64 PS   6uoc  COMPA1 Computing Electives
COMP1531 22T1 Software Engineering Fundamentals        92 HD   6uoc  Foundational Computing
COMP3121 22T1 Algorithms and Programming Techniques    69 CR   6uoc  Comp Sci Advanced Core
COMP3411 22T1 Artificial Intelligence                  72 CR   6uoc  COMPA1 Computing Electives
ARTS1270 22T2 Global History: Exploring the First Glob  - AW   unrs
COMP2511 22T2 Object-Oriented Design and Programming   68 CR   6uoc  Foundational Computing
COMP3421 22T3 Computer Graphics                        65 CR   6uoc  COMPA1 Computing Electives
COMP4920 22T3 Management and Ethics                    84 DN   6uoc  Comp Sci Advanced Core
COMP3231 23T1 Operating Systems                        66 CR   6uoc  COMPA1 Computing Electives
COMP6080 23T1 Web Front-end Programming                76 DN   6uoc  COMPA1 Free Electives
DDES1110 23T1 3D Visualisation 1 - 3D Virtual Objects  67 CR   6uoc  COMPA1 Free Electives
COMP3900 23T2 Computer Science Project                 97 HD   6uoc  Comp Sci Advanced Core
COMP9313 23T2 Big Data Management                      80 DN   6uoc  COMPA1 Free Electives
UOC done for this program and stream = 144, WAM = 76.522
Eligible to graduate

The later COMP courses ended up as COMPA1 Free Electives because once the
COMPA1 Computing Electives has sufficient courses, we stop adding them to that
requirement in the hopes of filling one of the other requirements. If we didn't
do this, the COMPA1 Computing Electives would have ended up with 48 UOC and the
COMPA1 Free Electives would not have enough UOC to meet the minimum 30UOC, even
though the student has taken enough courses to graduate.
To some extent, this is a consequence of using a depth-first (greedy) search
of the space of possible course→requirement allocation.


$ python3 q5.py 5893146 3778
5893146 Aung, Timothy Russell
3778 COMPA1 Computer Science
... same output as above ...

$ python3 q5.py 5893146 3778 COMPA1
5893146 Aung, Timothy Russell
3778 COMPA1 Computer Science
... same output as above ...

$ python3 q5.py 5893146 3778 COMPD1
5893146 Aung, Timothy Russell
3778 COMPD1 Computer Science
ACCT1501 20T1 Accounting and Financial Management 1A   93 HD   6uoc  General Education
COMP1511 20T1 Programming Fundamentals                  - SY   6uoc  Foundational Computing
MATH1141 20T1 Higher Mathematics 1A                     - SY   6uoc  Comp Sci Maths
COMP1521 20T2 Computer Systems Fundamentals            55 UF   fail
ECON1101 20T2 Microeconomics 1                         85 HD   6uoc  General Education
MATH1231 20T2 Mathematics 1B                           74 CR   6uoc  Comp Sci Maths
COMP2521 20T3 Data Structures and Algorithms           86 HD   6uoc  Foundational Computing
MATH1081 20T3 Discrete Mathematics                     79 DN   6uoc  Comp Sci Maths
COMP3311 21T1 Database Systems                         88 HD   6uoc  COMPD1 Core
ECON1102 21T1 Macroeconomics 1                         68 CR   6uoc  COMPD1 Free Electives
MGMT1001 21T1 Managing Organisations and People        76 DN   6uoc  COMPD1 Free Electives
COMP1521 21T2 Computer Systems Fundamentals            85 HD   6uoc  Foundational Computing
PSYC1001 21T2 Psychology 1A                            71 CR   6uoc  COMPD1 Free Electives
COMP3331 21T3 Computer Networks and Applications       64 PS   6uoc  COMPD1 Computing Electives
COMP1531 22T1 Software Engineering Fundamentals        92 HD   6uoc  Foundational Computing
COMP3121 22T1 Algorithms and Programming Techniques    69 CR   6uoc  Comp Sci Advanced Core
COMP3411 22T1 Artificial Intelligence                  72 CR   6uoc  COMPD1 Free Electives
ARTS1270 22T2 Global History: Exploring the First Glob  - AW   unrs
COMP2511 22T2 Object-Oriented Design and Programming   68 CR   6uoc  Foundational Computing
COMP3421 22T3 Computer Graphics                        65 CR   6uoc  COMPD1 Free Electives
COMP4920 22T3 Management and Ethics                    84 DN   6uoc  Comp Sci Advanced Core
COMP3231 23T1 Operating Systems                        66 CR   6uoc  COMPD1 Free Electives
COMP6080 23T1 Web Front-end Programming                76 DN   0uoc  Could not be allocated
DDES1110 23T1 3D Visualisation 1 - 3D Virtual Objects  67 CR   0uoc  Could not be allocated
COMP3900 23T2 Computer Science Project                 97 HD   6uoc  Comp Sci Advanced Core
COMP9313 23T2 Big Data Management                      80 DN   6uoc  COMPD1 Electives
UOC done for this program and stream = 132, WAM = 76.522
Need 12 more UOC for COMPD1 Electives

The reason this doesn't work for graduation is that the COMPD1
requirements are more restrictive than the COMPA1 requirements.
COMP6080 does not fit the COMPD1 Electives requirement, and
all the other requirements are "full". COMP9313 is explicitly
mentioned in the COMPD1 Electives list.


$ python3 q5.py 5893146 3707 COMPBH
5893146 Aung, Timothy Russell
3707 COMPBH Engineering (Honours)
ACCT1501 20T1 Accounting and Financial Management 1A   93 HD   6uoc  General Education
COMP1511 20T1 Programming Fundamentals                  - SY   6uoc  Foundational Computing
MATH1141 20T1 Higher Mathematics 1A                     - SY   6uoc  COMPBH Maths
COMP1521 20T2 Computer Systems Fundamentals            55 UF   fail
ECON1101 20T2 Microeconomics 1                         85 HD   6uoc  General Education
MATH1231 20T2 Mathematics 1B                           74 CR   6uoc  COMPBH Maths
COMP2521 20T3 Data Structures and Algorithms           86 HD   6uoc  Foundational Computing
MATH1081 20T3 Discrete Mathematics                     79 DN   0uoc  Could not be allocated
COMP3311 21T1 Database Systems                         88 HD   6uoc  COMPBH Computing Electives
ECON1102 21T1 Macroeconomics 1                         68 CR   0uoc  Could not be allocated
MGMT1001 21T1 Managing Organisations and People        76 DN   0uoc  Could not be allocated
COMP1521 21T2 Computer Systems Fundamentals            85 HD   6uoc  Foundational Computing
PSYC1001 21T2 Psychology 1A                            71 CR   0uoc  Could not be allocated
COMP3331 21T3 Computer Networks and Applications       64 PS   6uoc  COMPBH Computing Electives
COMP1531 22T1 Software Engineering Fundamentals        92 HD   6uoc  Foundational Computing
COMP3121 22T1 Algorithms and Programming Techniques    69 CR   6uoc  COMPBH Computing Electives
COMP3411 22T1 Artificial Intelligence                  72 CR   6uoc  COMPBH Computing Electives
ARTS1270 22T2 Global History: Exploring the First Glob  - AW   unrs
COMP2511 22T2 Object-Oriented Design and Programming   68 CR   6uoc  Foundational Computing
COMP3421 22T3 Computer Graphics                        65 CR   6uoc  COMPBH Computing Electives
COMP4920 22T3 Management and Ethics                    84 DN   6uoc  COMPBH Advanced Core
COMP3231 23T1 Operating Systems                        66 CR   6uoc  COMPBH Advanced Core
COMP6080 23T1 Web Front-end Programming                76 DN   6uoc  COMPBH Computing Electives
DDES1110 23T1 3D Visualisation 1 - 3D Virtual Objects  67 CR   0uoc  Could not be allocated
COMP3900 23T2 Computer Science Project                 97 HD   0uoc  Could not be allocated
COMP9313 23T2 Big Data Management                      80 DN   0uoc  Could not be allocated
UOC done for this program and stream = 102, WAM = 76.522
Need 12 more UOC for COMPBH Maths
- MATH2069 Mathematics 2A
- MATH2099 Mathematics 2B
Need 30 more UOC for COMPBH Physics and Electronics
- PHYS1121 Physics 1A
  or PHYS1131 Higher Physics 1A
- PHYS1221 Physics 1B
  or PHYS1231 Higher Physics 1B
- ELEC1111 Electrical and Telecommunications Engineering
- ELEC2133 Analogue Electronics
- ELEC2134 Circuits and Signals
Need 12 more UOC for COMPBH Design
- ENGG1000 Introduction to Engineering Design and Innovation
  or DESN1000 Introduction to Engineering Design and Innovation
- DESN2000 Engineering Design and Professional Practice
Need 36 more UOC for COMPBH Advanced Core
- COMP3211 Computer Architecture
- COMP3222 Digital Circuits and Systems
- COMP3601 Design Project A
- COMP4601 Design Project B
- COMP4951 Research Thesis A
- COMP4952 Research Thesis B
- COMP4953 Research Thesis C
Need 0 more UOC for Industrial Training
- ENGG4999 Industrial Training

$ python3 q5.py 5893146 3778 JAPNE1
5893146 Aung, Timothy Russell
3778 JAPNE1 Computer Science
JAPNE1 is not a stream in 3778

$ python3 q5.py 5892943
5892943 Zhou, Bingqi
3778 COMPA1 Computer Science
COMP1511 21T1 Programming Fundamentals                 73 CR   6uoc  Foundational Computing
MATH1081 21T1 Discrete Mathematics                     67 CR   6uoc  Comp Sci Maths
MATH1131 21T1 Mathematics 1A                           69 CR   6uoc  Comp Sci Maths
COMP1521 21T2 Computer Systems Fundamentals            77 DN   6uoc  Foundational Computing
COMP2521 21T2 Data Structures and Algorithms           58 PS   6uoc  Foundational Computing
FINS1613 21T3 Business Finance                         59 PS   6uoc  General Education
MATH1231 21T3 Mathematics 1B                           61 PS   6uoc  Comp Sci Maths
COMP1531 22T1 Software Engineering Fundamentals        85 HD   6uoc  Foundational Computing
COMP3311 22T1 Database Systems                         34 FL   fail
FINS2624 22T1 Portfolio Management                     51 PS   6uoc  General Education
COMP2041 22T2 Software Construction: Techniques and To 50 PS   6uoc  COMPA1 Free Electives
DART1110 22T2 Drawing 1: Foundations                   74 CR   6uoc  COMPA1 Free Electives
BABS1111 22T3 Big Fat Myths                            76 DN   6uoc  COMPA1 Free Electives
FINS3633 22T3 Real Estate Finance                      84 DN   6uoc  COMPA1 Free Electives
INFS2602 22T3 Managing Information Systems             67 CR   6uoc  COMPA1 Free Electives
FINS2643 23T0 Wealth Management                        67 CR   6uoc  COMPA1 Free Electives
PHYS1160 23T0 Introduction to Astronomy                61 PS   0uoc  Could not be allocated
COMP2511 23T1 Object-Oriented Design and Programming    - NC   unrs
COMP3311 23T1 Database Systems                         56 PS   6uoc  COMPA1 Computing Electives
COMP3411 23T1 Artificial Intelligence                  63 PS   6uoc  COMPA1 Computing Electives
COMP3331 23T2 Computer Networks and Applications       69 CR   6uoc  COMPA1 Computing Electives
COMP3900 23T2 Computer Science Project                 92 HD   6uoc  Comp Sci Advanced Core
COMP3121 23T3 Algorithms and Programming Techniques     -  -
COMP9444 23T3 Neural Networks and Deep Learning         -  -
UOC done for this program and stream = 114, WAM = 66.333
Need 6 more UOC for Foundational Computing
- COMP2511 Object-Oriented Design and Programming
Need 12 more UOC for Comp Sci Advanced Core
- COMP3121 Algorithms and Programming Techniques
  or COMP3821 Extended Algorithms and Programming Techniques
- COMP4920 Management and Ethics
Need 12 more UOC for COMPA1 Computing Electives

COMP2041 is not in the COMPA1 Computing Electives list, so counts as
a Free Elective.
By the time PHYS1160 was considered, the COMPA1 Free Electives bucket
was full; so PHYS1160 can't count towards the degree.
COMP2511 was not resolved, so it counts for 0 UOC.
We don't assume that students will pass courses currently being studied
(e.g. COMP3121)