Journal 17

 May 14 - May 20

An SQL view is an implementation of a virtual table made through a saved query. Utilizing the SELECT keyword, the database gathers results that fit the query and returns the results that fit the criteria. This is similar to a table in that you can view, join, update, and delete from an SQL view. Key differences include the lack of stored data, as tables actually store rows of information. In addition, there is no primary key declared on views. Referencing back to the similarities in function, there is a slight difference in that views must be defined over a single table in order to execute inserts, updates, and deletes, as inserting into a view that joins or aggregates data from two tables does not work. Further contrasting the two, during altering or dropping a base table or column, dependent views may break and need to be redefined.

When comparing SQL to Java, both languages allow for functions to be performed on saved data. In Java, if, for, and while loops control the flow of the program through exception handling and recursion, while SQL uses words such as WHERE and CASE. As mentioned in the prompt, the return of evaluated expressions is notated as SELECT in SQL and return in Java. In the declaration of variables, SQL is limited to singular rows at a time, whereas Java allows for the creation of custom classes in addition to generics. In dealing with errors or constraints, SQL has transaction rollbacks, where Java allows for try/catch exceptions to avoid errors. Unique to SQL, joins and aggregates can be applied over vast amounts of rows of data with just singular statements. Through our labs where we created the Java version of SQL functions, it is clear to see that much more than a single line of code would be necessary to perform the same functions- especially on such a huge scale- in Java. One of the biggest differences in Java is the data structures utilized in object oriented design, allowing for inheritance and polymorphism through customizable object classes. 

Comments

Popular Posts