For what is view useful? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

For what is view useful?

Would like to know for what is view useful... For example, for what I would create a view if I already have tables created and can do selects' commands to find datas? I was thinking, programmers use view to make easy find datas without do the same select command again and again (mainly when there are a lot JOINS...). Abridgeding, view would be like a "easy shortcut" to select datas that the programmers would have to do many times, am I correct?

11th Sep 2019, 2:56 AM
Gabriel Felix dos Santos
Gabriel Felix dos Santos - avatar
2 Answers
+ 6
Database views are useful for restricting access to other aspects of the underlying tables. It might be for protecting sensitive data or abstracting the source of the original data. Read permissions can also be applied on the view as if it was a table. These permissions could be less restrictive than their source tables.
11th Sep 2019, 3:16 AM
David Carroll
David Carroll - avatar
+ 2
Hello nice to meet you. A view is nothing more than a table generated from the result of a query that is "self-updating" as the related tables in the view query are loaded with data. This can be by: - Greater ease when consulting related data without having to be writing (or copying and pasting) the same query - From the view you can make queries as if it were a table itself From the previous point we have that if the columns resulting from an X query that relates to W, Y, Z table, you can make inquiries about them, say that in the People view, resulting from the query on the tables W, X, Y, Z , we have the columns: identification, email, profession, position, we can make a query like this: SELECT ID, email, profession FROM people WEHERE ID = "-----"
11th Sep 2019, 3:07 AM
Giovanny Avila
Giovanny Avila - avatar