CST 363 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) ?
SQL view is not a table itself but rather a way for one to look at the data from other tables, even up to multiple tables, in one query. It is the result of how one executes a 'select' query. However, you can run a 'select' query on it as if it were a table. But because it is not a table, it does not store any data and does not have a direct way of creating a primary key. It cannot be updated if it joins more than one tables or includes any aggregates.
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?
A big difference I notice about SQL is that it is more intuitive and straightforward. With programming languages, the biggest issue is that the machine does exactly what you want it to do and how it is executed, so that means you have to be exact and cover all possible outliers. In SQL, it is much shorter and more focused on accessing data. I tell the machine what I want, and it handles how that information is retrieved on the backend. However, the 'select' statements are similar to 'if' and 'switch' statements from programming languages. There are also operators to compare values in addition to basic functions that allows calculations to be done on the back end, like 'sum', 'avg', and even 'max' or 'min'. Not sure if this is something that I will learn down the line with SQL, but recursions have not yet become a topic. Although, it seems on the backend of the queries, some form of recursion is occurring to collect all the data that satisfies the 'select' query.
SQL view is not a table itself but rather a way for one to look at the data from other tables, even up to multiple tables, in one query. It is the result of how one executes a 'select' query. However, you can run a 'select' query on it as if it were a table. But because it is not a table, it does not store any data and does not have a direct way of creating a primary key. It cannot be updated if it joins more than one tables or includes any aggregates.
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?
A big difference I notice about SQL is that it is more intuitive and straightforward. With programming languages, the biggest issue is that the machine does exactly what you want it to do and how it is executed, so that means you have to be exact and cover all possible outliers. In SQL, it is much shorter and more focused on accessing data. I tell the machine what I want, and it handles how that information is retrieved on the backend. However, the 'select' statements are similar to 'if' and 'switch' statements from programming languages. There are also operators to compare values in addition to basic functions that allows calculations to be done on the back end, like 'sum', 'avg', and even 'max' or 'min'. Not sure if this is something that I will learn down the line with SQL, but recursions have not yet become a topic. Although, it seems on the backend of the queries, some form of recursion is occurring to collect all the data that satisfies the 'select' query.
Comments
Post a Comment