0

I understand that a view is only a saved SQL query that can be considered as a virtual table. However, it seems to me that there is not much difference between creating a new table using the SELECT INTO statement and creating a view. What are some of the major distinctions between the two methods? Under what situations would you use one or the other?

Danny Brown
  • 17
  • 1
  • 6
  • 1
    A table and a view are completely different. A view doesn't store the data, it's stored else where. If you update the underlying table, then the data displayed on the view will too; that doesn't happen when you create a new table. – Thom A Nov 07 '19 at 20:11
  • What is the context here? Are you trying to solve an actual problem? Or trying to further your understanding? – Dale K Nov 07 '19 at 20:12
  • 2
    These two things are similar like mangoes and hamsters. You are asking about the differences between two things so dissimilar the list is nearly endless. Now find commonalities between these two things. That is a manageable list, albeit extremely short. – Sean Lange Nov 07 '19 at 20:32

1 Answers1

1

Let's start with aknowledging that by what you say about views, you are not talking about indexed views. Because these are actually implemented with existing tables in the background. So, we are talking about non-indexed views.

The two methods are very different - in fact, they have nothing in common. It is strange, because you both mention:

  • "view = only saved sql query"
  • "into = creating new table"

Isn't this a contradiction? The result of select into is actually a table, a view is not.

Not sure why are you asking about this or what are you trying to accomplish. In my experience, I use select into to fastly create logically temporary tables that have the same columns with the original without having to type all columns. This method of creating tables is generally inferior to the create table command and a subsequent insert, because no indexes and other stuff can be made - thus its use in adhoc queries or as a temporary entity.

George Menoutis
  • 6,894
  • 3
  • 19
  • 43