Monday, September 22, 2025

Week 18

This week we had our first exam, and it was harder than I expected. I realized there were details in SQL that I needed to review more carefully, so it was a good reminder that practice is very important. Even though it was challenging, it also helped me see which parts of SQL I understand well and which ones I still need to improve.

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 virtual table that is created from a query. It looks like a table because I can select rows and columns from it, but it is different because the data is not stored separately. A view usually does not have a primary key, and in most cases I cannot do insert, update, or delete operations on it like I can with a real table. It is mostly used for simplifying queries or for security, when I only want to show part of the data.

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. 

Now that we have completed our study of SQL for this course, I can also compare it to Java. Both SQL and Java have ways to filter and control what happens: a WHERE clause in SQL works kind of like an if statement in Java, because both decide which rows or conditions are true. The SELECT in SQL is similar to a return in Java, since it shows what data should come back. At the same time, SQL is declarative — I just say what I want and the database does it — while Java is procedural and requires me to write step by step instructions. Java also has things like loops, methods, and objects, which don’t exist in SQL. SQL, on the other hand, has joins and aggregations that are specific to working with large sets of data.

From my point of view, I realized that when working with databases, it is better to use SQL. In my opinion, it is specialized for that purpose and makes the work much easier than trying to do the same tasks in a general programming language. SQL was designed for data, and this makes it more efficient and natural to use when handling tables, queries, and relationships.

No comments:

Post a Comment

Week 28

This week’s focus on concurrency and threads felt like a big shift from everything we have done so far. Until now, processes always felt sim...