Week 3 learning journal CST 363

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) ?

A view is a saved select query that acts like a virtual table, so I can query it and join it just like a real table. It is similar to a table because it shows rows and columns and I can use the same select syntax on it. It is different because it does not store data itself, it usually does not have its own primary key, and many views are read only, so insert, update, and delete only work if the view is updatable and maps each row back to one row in a base 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. 

With SQL I state the result I want and the database figures out how to get it, while with Java I write the steps to get the result. Both SQL and Java use expressions and comparisons. A where clause is like an if test, and the select list is what I want returned. SQL works on sets of rows stored in a database with transactions and indexes. Java works with objects in memory, and I use loops and other control flow to process them. SQL has null so a condition can be true, false, or unknown. Java conditions are only true or false.

Comments

Popular posts from this blog

Week 4 Learning Journal

Week 2 Learning Journal

Week 7 Learning Journal