• Database

    UNPIVOT in SQL

    Below example converts rows to columns using UNPIVOT clause. Assuming you have a table like this: And you want to convert like this: Use the query: You can also apply WHERE clause like this: Result:

  • Data - Database

    SSAS: Dimension Relationships in Cubes

    “Dimension relationship” refers to the direct or indirect relationships between dimension and its measure groups in a Cube. Regular Refers to a standard relationship, when a Key column in the dimension is directly joined to fact table. Reference When a Key column in the dimension is indirectly joined to fact table by referencing another dimension. Fact / Degenerate Dimensions constructed from attribute columns in fact tables than from attribute columns in dimension tables. Many-to-Many One dimension is associated with multiple facts Read more: https://docs.microsoft.com/en-us/sql/analysis-services/multidimensional-models-olap-logical-cube-objects/dimension-relationships?view=sql-server-2017 Note: My study notes

  • Database - Technology

    Why Cosmos DB may not be apt for building Data Warehouse?

    Well, the question is slightly wrong until the context is specified because it is possible to build Modern Data Warehouse by including Cosmos DB in the architecture. This is too much relevant today because the data is no more straight forward content with human readable entities and relations (structured), but unstructured and/or streaming too. Also the pace of the data flow, or business requirement is becoming near real-time. See a reference architecture below: Image Source: MS Docs Here, in this blog, the context is about Traditional Data Warehouse possibility, where you will be modelling the data, specifying relationships, etc. Let…

  • Data - Database - Technology

    Getting started with Azure Databricks

    Introduction What is Azure Databricks? Azure Databricks is the same Apache Databricks, but a managed version by Azure. This managed service allows data scientists, developers, and analysts to create, analyse and visualize data science projects in cloud. Databricks is a user friendly, analytics platform built on top of Apache Spark. Databricks acts as an UI layer, a WYSIWYG dashboard where you can create clusters, manage notebooks, write code and analyse data without knowing the internals of the system. Apache Spark is a unified analytics engine for large scale data processing and currently it supports popular languages such as Python, Scala,…

  • Database

    SQL Server 2016 Row Level Security (RLS) Implementation

    Row Level Security Capability was introduced with 2016 version SQL Server. Same is available in Azure SQL Database also as of today. This blog will detail a novice example on how to implement. This is the planned implementation flow: About the example Prepare Sample data Create Predicate function Apply Security Policy Test Security 1. Plot For the purpose of example, we will take the case of an imaginary Super market. Let us assume there are Supervisors assigned to each department in the shop and we want each supervisor to see only items he is responsible for. RLS is applied on…