CST 363: Week 3
1) 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 table constructed of columns taken from one or more established tables. An SQL view is similar to a base table as they consist of the same structure where columns share the same data types and rows show correlating data among the various columns. Both views and base tables can be used to perform queries and joins. Some differences between the two include that base tables consist of their own primary keys, while view tables do not. Additionally, data from base tables are stored physically in the disk while view tables are virtual and data from a view tables are dependent on the state data that they retrieve from the base table. Because of these circumstances, insert, update and delete operations do not always work when trying to update a view table and can affect a view table if these statements are used on any referenced base tables.
2) 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.
Java and SQL both utilize programming tools like relational, conditional and logical operators, literals, and comments. In terms of what SQL has that Java does not, SQL utilizes various keywords for creating, altering, and deleting database objects, managing permissions and security, performing aggregation and analysis on data, combining data, implementing database objects and establishing constraints. In terms of what Java has that SQL does not, Java utilize keywords for defining objects and how they may or may not relate to one another, repeating blocks of code, managing runtime errors, allocating and deallocating memory, and handling data between resources like the program itself and files or consoles.
Comments
Post a Comment