CST363 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 essentially a virtual table created by a query that selects data from one or more tables. It looks and behaves like a table when you query it, but unlike actual tables, views do not store data themselves. Instead, they present a dynamic result set based on the underlying tables. Unlike tables, views usually cannot be modified directly; insert, update, and delete operations are typically restricted, especially for complex views involving joins or aggregations.
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.
Comparing SQL to Java, both languages share some similarities in their control structures. For example, SQL’s WHERE clause for filtering data is akin to Java’s if statements for conditional execution. The SELECT clause in SQL, which specifies what data to retrieve, is similar to Java’s return statements that define method outputs. However, SQL is a declarative language focused on querying and manipulating data, while Java is an imperative language with detailed procedural logic and object-oriented features. SQL handles data efficiently but lacks the procedural control and extensive syntax of Java.
Comments
Post a Comment