Learning Journal 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) ?
Views in SQL are very similar to tables, but a bit more flexible. A normal query is a command that needs to be ran every time, whereas a view can be stored and reused over and over again. Views are virtual tables that can show data similar to a table without the constraints of primary and foreign keys. A table requires primary and foreign keys to maintain relational integrity. Since tables store data directly, rows can be inserted, updated, and deleted. Since views are just structured,reusable queries, the data cannot be meddled with and adds a layer of security to a database.
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.
SQL and a language like Java have many similarities. First of all, both languages are type sensitive and are static typed languages. This rigidity allows for clear input and output of queries and manulations of variables. Another syntactic similarity is the way conditional logic works. SQL’s WHERE and CASE key works mirror the purpose of Java’s IF and SWITCH keywords respectively. Logic is used to help narrow down the data and in JAVA it is used to designate the outcome based on the input. But a a big difference between both SQL and Java is the purpose it is used for. SQL is a great way to store, manage, and organize data; whereas JAVA is used as way to communicate to a computer to create tools, applications, and programs. Another big difference is that SQL has built in functions/methods used to pull or organize data, whereas a programming langue like java requires the user to define these functions and data structures
Comments
Post a Comment