Csc 1302, Honors Principles of Computer Science II (Fall 2023)

Phase 1 Testing

  1. During this week you will write Python programs to answer queries 4, 5, and 7 from Company Database Queries in Relational Algebra. Test cases for Queries 1,2,3, and 6 are available at: Query1.py, Query2.py, Query3.py, and Query6.py. The sample database for these queries is available at company and this folder is also available as company.zip.
  2. Run all 7 Python programs to see if you get correct answers. This should test all of the code that you have developed until now.
The outputs produced for all 7 queries are shown below:
Mac-mini:w7 raj$ python3 Query1.py company
ANSWER(FNAME:VARCHAR,LNAME:VARCHAR,ADDRESS:VARCHAR)
Number of tuples:4

Franklin:Wong:638 Voss, Houston, TX:
John:Smith:731 Fondren, Houston, TX:
Ramesh:Narayan:971 Fire Oak, Humble, TX:
Joyce:English:5631 Rice, Houston, TX:

mirage:week9-testcases raj$ python3 Query2.py company
ANSWER(PNUMBER:INTEGER,DNUM:INTEGER,LNAME:VARCHAR,ADDRESS:VARCHAR,BDATE:VARCHAR)
Number of tuples:2

10:4:Wallace:291 Berry, Bellaire, TX:20-JUN-31:
30:4:Wallace:291 Berry, Bellaire, TX:20-JUN-31:

mirage:week9-testcases raj$ python3 Query3.py company
ANSWER(LNAME:VARCHAR,FNAME:VARCHAR)
Number of tuples:2

Zelaya:Alicia:
Jabbar:Ahmad:

mirage:week9-testcases raj$ python3 Query4.py company
ANSWER(PNO:INTEGER)
Number of tuples:4

1:
2:
91:
92:

mirage:week9-testcases raj$ python3 Query5.py company
ANSWER(LNAME:VARCHAR,FNAME:VARCHAR)
Number of tuples:3

Wong:Franklin:
Smith:John:
Smith:Alex:

mirage:week9-testcases raj$ python3 Query6.py company
ANSWER(LNAME:VARCHAR,FNAME:VARCHAR)
Number of tuples:34

Borg:James:
Zelaya:Alicia:
Narayan:Ramesh:
English:Joyce:
Jabbar:Ahmad:
James:Jared:
James:John:
Jones:Jon:
Mark:Justin:
Knight:Brad:
Wallis:Evan:
Zell:Josh:
Vile:Andy:
Brand:Tom:
Vos:Jenny:
Carter:Chris:
Grace:Kim:
Chase:Jeff:
Snedden:Sam:
Ball:Nandita:
Bender:Bob:
Jarvis:Jill:
King:Kate:
Leslie:Lyle:
King:Billie:
Kramer:Jon:
King:Ray:
Small:Gerald:
Head:Arnold:
Pataki:Helga:
Drew:Naveen:
Reedy:Carl:
Hall:Sammy:
Bacher:Red:

mirage:week9-testcases raj$ python3 Query7.py company
ANSWER(LNAME:VARCHAR,FNAME:VARCHAR)
Number of tuples:3

Wong:Franklin:
Wallace:Jennifer:
Smith:Alex:

mirage:week9-testcases raj$