Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Project Overview:
    UC Berkeley CS 61B Project 2 (Spring 2017, Prof. Josh Hug):
    Using Java to implement a relational database management system
    controlled by SQL-like commands.

SCORE: 115.394 / 100.0
  * Median score among UC Berkeley students: ~50.0 / 100.0
  * I worked on this project while taking 19 units at UCLA, including Operating
    Systems and Computer Architecture, because I wanted to learn Java and
    explore projects from another university.
  * Graded on Gradescope using UC Berkeley's public autograder. Extra credit
    is awarded if you pass extra test cases.

Project Specifications:
    (or proj2.htm in the main directory)


How to Compile and Run:
    $ javac
    $ java Main
    $ <command(s)> (See Project Specifications: "Commands" and "Example")
    $ exit


I learned how to:
    1.) Design a Table data structure after experimenting with standard data
        structures like maps, lists, sets, and arrays.

        Final Table Design (See db/ for more details):
            LinkedHashMap<Integer, LinkedHashMap<String, String>>

        Some designs I thought about but abandoned after realizing flaws:
            a.) String[][]
            b.) HashMap<String, ArrayList>
            c.) LinkedHashMap<String, LinkedHashMap<String, String>>
                This one has a subtle difference from the final design, but
                its use is too complicated to maintain and eventually becomes a
                nasty problem in the join() function.

    2.) Implement database management features, such as the
        merging of two tables (via the "natural inner join" algorithm) and the
        evaluation of column expressions and conditions used to extract desired
        columns and rows from tables.

    3.) Set a standard table format (.tbl), extract data from .tbl files
        to load tables into the database, and store data from the database
        into new .tbl files.

    4.) Parse through and put into effect commands that the user inputs to
        interact with the database, accounting for various combinations of
        whitespace (a quite painful process).


Notes to self:
    1.) Stop using == to compare Strings. Use String.equals().
    2.) Float comparisons using operators like ==, !=, etc. are incorrect.
        Use Float.compareTo().
You can’t perform that action at this time.