/
Database Views

Database Views

 

Overview

In this lesson, we are going to learn in which circumstances the views are useful and how to associate them from database in Wayfast.

What is a View in SQL?

A “View” is a virtual table based on the result-set of an SQL statement. You can think on a query that is stored on SQL and when used by a user, it will look and act just like a table but it’s not because does not have a definition or structure. Also the “View” does not require any storage in a database because it does not exist physically. We can also control user security for accessing the data from the database tables and we can allow users to get the data from the “View” and the user does not require permission for each table or column to fetch data.

CREATE VIEW SQL: Creating views in SQL Server

Views can be used for certain conditions in our project:

  • To simplify database structure to the individuals using it.

  • As a security mechanism to DBAs for allowing users to access data without granting them permissions to directly access the underlying base tables.

  • To provide backward compatibility to applications that are using our database.

Let’s check the syntax for an easy view in SQL that we can use later in the application:

CREATE VIEW Vw_HWD_Test AS SELECT * FROM Hello_World_Demo

After executing the new view in SQL, we can synchronize in Wayfast and make it available for association in our project. Open Wayfast and click on “End Task” button at left side navigation bar

A popup is displayed and there’s no need to change any requirement. We are going to synchronize Wayfast to get the new view available for development.

How to associate Database’s Views in Wayfast?

As precondition, make sure you have an “Active” requirement in Wayfast before starting this process.

In Wayfast, click on “Database” icon at top menu and then click on “Views” tab

You can find “Views” dashboard with all the columns related to the objects related to the Project. We are going to click on “Associate Views” button to add the new view created in SQL and previously synchronized.

A popup is displayed on screen. You can retrieve all the “view” objects from the specific instance and database selection. Click on “Assign” button after selecting the view

The new object is displayed on “View” dashboard. In case you need to add multiple views at the same time from one specific database, we can check “Multi Assign” checkbox

All the views are going to be listed in the popup and ready to be checked for assignation.

In case we need to review the “View” script in Wayfast, click on “View Script” pencil icon and you can verify the function associated to the project. Query Analyzer will be opened in another tab to verify the syntax

In case you have to edit the script, “Synchronize” button will establish the connection to the database and update what we modified in Wayfast.

Recap

In this lesson, we learnt that Views are like a virtual table that contains data from one or multiple tables. Also we explained how to create and edit view’s statements in SQL that we can easily synchronize them by selecting the correct instance in Wayfast.

 

Related content

Datasets
Datasets
More like this
Explore and Associate DB Objects (Tables)
Explore and Associate DB Objects (Tables)
More like this
Stored Procedures (Archive)
Stored Procedures (Archive)
Read with this
Query Analyzer (Draft)
Query Analyzer (Draft)
More like this
ERD (Draft)
ERD (Draft)
Read with this
DB Documentation
DB Documentation
More like this