Creating an SQL View
Create a view to query sources in a powerful SQL editor. You can choose between writing a standard SQL query using SELECT statements and operators such as JOIN and UNION, or use SQLScript to produce a table function. You can drag sources from the Source Browser, and specify measures and other aspects of your output structure in the side panel.
Prerequisites
-
Data Warehouse General (-R------) - To access SAP Datasphere.
-
Data Warehouse Data Builder (CRUD----) - To create, edit, and delete a graphical view.
-
Space Files (CRUD----) - To create, read, update, and delete objects in your spaces.
-
Data Warehouse AI Consumption (----E---) - To use SAP Business AI features.
Context
-
Various columns are selected from the Sales and Products entities and given aliases via the AS keyword.
-
A new, calculated column, Unit_Price is created using the ROUND() function.
-
The FROM clause defines an INNER JOIN between the entities on their Product_ID columns.
-
The WHERE clause filters the results by the Product_Line, which must be Electronics.
-
The ORDER BY clause orders the results by the value of Gross_Sales in descending order.
SELECT
"Sales"."Date" AS "Date",
"Products"."Product_ID" AS "Product_ID",
"Products"."Line" AS "Product_Line",
"Products"."Category" AS "Product_Category",
"Products"."Product" AS "Product",
ROUND("Sales"."Gross_Sales" / "Sales"."Quantity", 2) AS "Unit_Price",
"Sales"."Gross_Sales" AS "Gross_Sales"
FROM ("Sales" INNER JOIN "Products" ON "Sales"."Product_ID" = "Products"."Product_ID")
WHERE "Products"."Product_Line" = "Electronics"
ORDER BY "Gross_Sales" DESC
-
Instruct AI to write SQL for you (see Generate SQL Code with AI).
-
Use the graphical view editor, which lets you compose SQL code using an intuitive graphical interface (see Creating a Graphical View).
For information about making your data accessible outside SAP Datasphere, see Exposing Data For Consumption.
-
List, create, read, update, and delete them using the datasphere command line interface (see Managing Modeling Objects via the Command Line).
-
Export and import them via the secure Transport app (see Transporting Content Between Tenants).
-
Export and import them via CSN files (see Importing and Exporting Objects in CSN/JSON Files).
