CST363 Week 3

What is an SQL view.  How is it similar to a table? In what ways is it different (think about primary keys,  insert, update, delete operations) ?

An SQL view is a stored query, thereby making it a virtual table. Since the view does not hold data, it conducts the search of the data in one or more tables while being asked for. A view shares very similar characteristics as those of a table for example you can run SELECT statements against the view as if the view were a table, and it will display the result set in tabular format. In general, views do not have primary keys or indexes, and they cannot always be used as the targets for direct updates. Meanwhile, a few views are updateable in case they are based on a single table without complex joins and so forth whereas the majority are read-only. Very useful aspects of views are the simplification of queries, it improves readability, and restricting a user's access to either some of the columns or some of the rows without giving them full access to the whole table.

We have completed our study of SQL for this course.  This is not to imply that we have studied everything in the language.  There are many specialized features such as calculating rolling averages, query of spatial data (data with latitude and longitude) coordinates, and more. But take a minute to think about how SQL compares to other programming languages such as Java.  What features are similar , and which are present in one language but not in the other?  For example,  Java has conditional if statements which are similar to SQL WHERE predicates,  the SELECT clause is similar to a RETURN statement in that it specifies what data or expression values are to be returned in the query result (although it is strange that a statement should specify the RETURN as the first part of a SELECT.

SQL and Java's intent is very different but does go through some logical parallelisms. SQL is considered a declarative language, you tell it what you want, and the database figures out how to get it. Java is rather procedural and object oriented, you define stepwise instructions to get a goal. There are differences but also similarities, like SQL WHERE clauses filter results based on conditions, and SQL SELECT somewhat resembles Java's return keyword in that both return something, values in Java while sets of data in SQL. Big difference would be in the way SQL deals with sets and relationships between data whereas Java concentrates on logic, flow, and basically the structure of programs. SQL lacks many of the basic programming features Java enjoys, such as looping, classes, and methods, although some advanced dialects do provide procedural extensions. So, in a nutshell, SQL and Java are a good match for one another. SQL handles the data side, and Java handles program logic.

Comments

Popular posts from this blog

Week 4 - Goals!

Week 2 - Second week of class!

Week 4 - Interview with Industry Expert