<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Usman Ahmed on Medium]]></title>
        <description><![CDATA[Stories by Usman Ahmed on Medium]]></description>
        <link>https://medium.com/@rajausmanahmedkhan?source=rss-df806577571a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5g5S0WFt71kgvb97UpExZA.jpeg</url>
            <title>Stories by Usman Ahmed on Medium</title>
            <link>https://medium.com/@rajausmanahmedkhan?source=rss-df806577571a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 22:29:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rajausmanahmedkhan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Amazon EC2 Instance Lifecycle]]></title>
            <link>https://medium.com/@rajausmanahmedkhan/amazon-ec2-instance-lifecycle-a142257dff19?source=rss-df806577571a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a142257dff19</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ec2lifecycle]]></category>
            <category><![CDATA[amazon-ec2]]></category>
            <category><![CDATA[lifecycle]]></category>
            <dc:creator><![CDATA[Usman Ahmed]]></dc:creator>
            <pubDate>Thu, 30 Mar 2023 18:43:33 GMT</pubDate>
            <atom:updated>2023-03-30T18:43:33.875Z</atom:updated>
            <content:encoded><![CDATA[<p>An EC2 instance transitions between different states from the moment you create it until its termination.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-xr7LD6SkMH0QtEcGXffmg.png" /></figure><ol><li>When you launch an instance, it enters the <strong>pending </strong>state. When an instance is pending, billing has not started. At this stage, the instance is preparing to enter the running state. Pending is where AWS performs all actions needed to set up an instance, such as copying the AMI content to the root device and allocating the necessary networking components.</li><li>When your instance is <strong>running</strong>, it’s ready to use. This is also the stage where billing begins. As soon as an instance is running, you can take other actions on the instance, such as reboot, terminate, stop, and stop-hibernate.</li><li>When you reboot an instance, it’s different than performing a stop action and then a start action. <strong>Rebooting </strong>an instance is equivalent to rebooting an operating system. The instance keeps its public DNS name (IPv4) and private and public IPv4 addresses. An IPv6 address (if applicable) remains on the same host computer and maintains its public and private IP address, in addition to any data on its instance store volumes.</li><li>When you stop your instance, it enters the <strong>stopping</strong> and then <strong>stopped</strong> state. This is similar to when you shut down your laptop. You can stop and start an instance if it has an Amazon Elastic Block Store (Amazon EBS) volume as its root device. When you stop and start an instance, your instance can be placed on a new underlying physical server. Your instance retains its private IPv4 addresses and if your instance has an IPv6 address, it retains its IPv6 address. When you put the instance into stop-hibernate, the instance enters the stopped state, but saves the last information or content into memory, so that the start process is faster.</li><li>When you <strong>terminate </strong>an instance, the instance stores are erased, and you lose both the public IP address and private IP address of the machine. Termination of an instance means that you can no longer access the machine. As soon as the status of an instance changes to <strong>shutting down </strong>or <strong>terminated, </strong>you stop incurring charges for that instance.</li></ol><h3>Difference between stop and stop-hibernate</h3><blockquote>When you stop an instance, it enters the stopping state until it reaches the stopped state. AWS does not charge usage or data transfer fees for your instance after you stop it. But storage for any Amazon EBS volumes is still charged. While your instance is in the stopped state, you can modify some attributes, like the instance type. When you stop your instance, the data from the instance memory (RAM) is lost.</blockquote><blockquote>When you stop-hibernate an instance, Amazon EC2 signals the operating system to perform hibernation (suspend-to-disk), which saves the contents from the instance memory (RAM) to the EBS root volume. You can hibernate an instance only if hibernation is turned on and the instance meets the hibernation prerequisites.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a142257dff19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Amazon EC2]]></title>
            <link>https://medium.com/@rajausmanahmedkhan/getting-started-with-amazon-ec2-27a85e27260f?source=rss-df806577571a------2</link>
            <guid isPermaLink="false">https://medium.com/p/27a85e27260f</guid>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[amazon-machine-images]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Usman Ahmed]]></dc:creator>
            <pubDate>Thu, 30 Mar 2023 18:31:00 GMT</pubDate>
            <atom:updated>2023-03-30T18:31:00.684Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="AWS" src="https://cdn-images-1.medium.com/max/1024/1*x0AfUg5WiimU8CaebFN_HQ.png" /></figure><p>Amazon EC2 is a web service that provides secure, resizable compute capacity in the cloud. With this service, you can provision virtual servers called EC2 instances.</p><p><strong>With Amazon EC2, you can do the following:</strong></p><ul><li>Provision and launch one or more EC2 instances in minutes.</li><li>Stop or shut down EC2 instances when you finish running a workload.</li><li>Pay by the hour or second for each instance type (minimum of 60 seconds).</li></ul><p>You can create and manage EC2 instances through the AWS Management Console, AWS CLI, AWS SDKs, automation tools, and infrastructure orchestration services.</p><p><strong>To create an EC2 instance, you must define the following:</strong></p><ul><li><strong>Hardware specifications: </strong>CPU, memory, network, and storage</li><li><strong>Logical configurations: </strong>Networking location, firewall rules, authentication, and the operating system of your choice</li></ul><h3><strong>Amazon Machine Image</strong></h3><blockquote>When launching an EC2 instance, the first setting you configure is which operating system you want by selecting an Amazon Machine Image (AMI).</blockquote><blockquote>In the traditional infrastructure world, spinning up a server consists of installing an operating system from installation disks, drives, or wizards over the network. In the AWS Cloud, the operating system installation is not your responsibility. Instead, it’s built into the AMI that you choose.</blockquote><blockquote>An AMI includes the operating system, storage mapping, architecture type, launch permissions, and any additional preinstalled software applications.</blockquote><h3>Relationship between AMIs and EC2 instances</h3><p>EC2 instances are live instantiations (or versions) of what is defined in an AMI, as a cake is a live instantiation of a cake recipe. If you are familiar with software development, you can also see this kind of relationship between a class and an object. In this case, the AMI is how you model and define your instance. The EC2 instance is the entity you interact with, where you can install your web server and serve your content to users.</p><p>When you launch a new instance, AWS allocates a virtual machine that runs on a hypervisor. Then the AMI that you selected is copied to the root device volume, which contains the image that is used to boot the volume. In the end, you get a server that you can connect to and install packages and additional software on. In the example, you install a web server along with the properly configured source code of your employee directory application.</p><figure><img alt="AMI" src="https://cdn-images-1.medium.com/max/476/1*rI_gezAoQ1CAPxbNfSLweg.png" /></figure><p>One advantage of using AMIs is that they are reusable. You might choose a Linux-based AMI and configure the HTTP server, application packages, and additional software that you need to run your application. If you want to create another EC2 instance with the same configurations, you could create and configure a new EC2 instance to match the first instance. Or you could create an AMI from your running instance and use the AMI to start a new instance. That way, your new instance would have the same configurations as your current instance because the configurations set in the AMIs are the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tdfsI_-cY0Hv5l_8acLmPg.png" /></figure><h3>Finding AMIs</h3><p>There are multiple ways to select an AMI. To learn more, expand each of the following five categories.<br>1. QuickStart AMIs<br>2. AWS Marketplace AMIs<br>3. My AMIs<br>4. Community AMIs<br>5. Custom Images</p><p>Each AMI in the AWS Management Console has an AMI ID, which is prefixed by <em>ami-</em>, followed by a random hash of numbers and letters. The IDs are unique to each AWS Region.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AYt8Zok2b9TA4qWbr7zVqQ.png" /></figure><h3>Configuring EC2</h3><p>Now that you know how to select an operating system for your EC2 instance, you are ready to choose other configurations to create your EC2 instance, such as the instance type, network, and storage.</p><p>For an application like the employee directory application, you need instances with enough capacity to process customer requests. Your instance sizing will depend on both the demands of your application and the anticipated size of your user base.</p><p>Forecasting server capacity for an on-premises application requires difficult decisions involving significant upfront capital spending. In contrast, changes to the allocation of your cloud-based services can be made with a simple API call. Because of the AWS pay-as-you-go model, you can match your infrastructure capacity to your application’s demand, instead of the other way around.</p><h3>Amazon EC2 instance types</h3><p>EC2 instances are a combination of virtual processors (vCPUs), memory, network, and, in some cases, instance storage and graphics processing units (GPUs). When you create an EC2 instance, you need to choose how much you need of each of these components.</p><figure><img alt="EC2 Types" src="https://cdn-images-1.medium.com/max/1024/1*fW8s-X4RWDqRp7uVzVCfrA.png" /></figure><p>AWS offers a variety of instances that differ based on performance. Some instances provide more capacity than others. To get an overview of the capacity details for a particular instance, you should look at the instance type. Instance types consist of a prefix identifying the type of workloads they’re optimized for, followed by a size. For example, the instance type c5n.xlarge can be broken down as follows:</p><ul><li><strong>First position </strong>— The first position, <strong>c</strong>, indicates the instance family. This indicates that this instance belongs to the compute optimized family.</li><li><strong>Second position </strong>— The second position, <strong>5</strong>, indicates the generation of the instance. This instance belongs to the fifth generation of instances.</li><li><strong>Remaining letters before the period </strong>— In this case, <strong>n</strong> indicates additional attributes, such as local NVMe storage.</li><li><strong>After the period </strong>— After the period, <strong>xlarge</strong> indicates the instance size. In this example, it’s xlarge.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*eF0AoY1EvWcGnJ5cwDi0nQ.jpeg" /></figure><h3><strong>Instance Family</strong></h3><p><strong>General purpose<br></strong>General purpose instances provide a balance of compute, memory, and networking resources, and can be used for a variety of workloads.<br>Ideal for applications that use these resources in equal proportions, such as web servers and code repositories.</p><p><strong>Compute optimized<br></strong>Compute optimized instances are ideal for compute-bound applications that benefit from high-performance processors.<br>Well-suited for batch processing workloads, media transcoding, high performance web servers, high performance computing (HPC), scientific modeling, dedicated gaming servers and ad server engines, machine learning inference, and other compute intensive applications.</p><p><strong>Memory optimized<br></strong>Memory optimized instances are designed to deliver fast performance for workloads that process large datasets in memory.<br>Memory-intensive applications, such as high-performance databases, distributed web-scale in-memory caches, mid-size in-memory databases, real-time big-data analytics, and other enterprise applications.</p><p><strong>Accelerated computing<br></strong>Accelerated computing instances use hardware accelerators or co-processors to perform functions such as floating-point number calculations, graphics processing, or data pattern matching more efficiently than is possible in software running on CPUs.<br>Machine learning, HPC, computational fluid dynamics, computational finance, seismic analysis, speech recognition, autonomous vehicles, and drug discovery.</p><p><strong>Storage optimized<br></strong>Storage optimized instances are designed for workloads that require high sequential read and write access to large datasets on local storage. They are optimized to deliver tens of thousands of low-latency random I/O operations per second (IOPS) to applications that replicate their data across different instances.<br>NoSQL databases (Cassandra, MongoDB and Redis), in-memory databases, scale-out transactional databases, data warehousing, Elasticsearch, and analytics.</p><p><strong>HPC optimized<br></strong>High performance computing (HPC) instances are purpose built to offer the best price performance for running HPC workloads at scale on AWS.<br>Ideal for applications that benefit from high-performance processors, such as large, complex simulations and deep learning workloads.</p><h3>EC2 instance locations</h3><p>Unless otherwise specified, when you launch EC2 instances, they are placed in a default virtual private cloud (VPC). The default VPC is suitable for getting started quickly and launching public EC2 instances without having to create and configure your own VPC.</p><p>Any resource that you put inside the default VPC will be public and accessible by the internet, so you shouldn’t place any customer data or private information in it.</p><p>When you get more comfortable with networking on AWS, you should change this default setting to choose your own custom VPCs and restrict access with additional routing and connectivity mechanisms.</p><h3>Architecting for high availability</h3><p>In the network, your instance resides in an Availability Zone of your choice. As you learned previously, AWS services that are scoped at the Availability Zone level must be architected with high availability in mind.</p><p>Although EC2 instances are typically reliable, two are better than one, and three are better than two. Specifying the instance size gives you an advantage when designing your architecture because you can use more smaller instances rather than a few larger ones.</p><p>If your frontend only has a single instance and the instance fails, your application goes down. Alternatively, if your workload is distributed across 10 instances and one fails, you lose only 10 percent of your fleet, and your application availability is hardly affected.</p><p>When architecting any application for high availability, consider using at least two EC2 instances in two separate Availability Zones. ­­</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*omZ5Ap0Z9OzNz3RMURytvQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27a85e27260f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Indexes in SQL Server]]></title>
            <link>https://medium.com/@rajausmanahmedkhan/indexes-in-sql-server-98e51a1de863?source=rss-df806577571a------2</link>
            <guid isPermaLink="false">https://medium.com/p/98e51a1de863</guid>
            <category><![CDATA[sql-server-index]]></category>
            <category><![CDATA[indexing]]></category>
            <category><![CDATA[index]]></category>
            <category><![CDATA[nonclustered-index]]></category>
            <category><![CDATA[clustered-index]]></category>
            <dc:creator><![CDATA[Usman Ahmed]]></dc:creator>
            <pubDate>Mon, 13 Mar 2023 17:36:23 GMT</pubDate>
            <atom:updated>2023-03-13T17:38:25.893Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5VbITCzdcZi8X8kSvkhtMA.jpeg" /></figure><p>SQL Server is a relational database management system (RDBMS) developed by Microsoft Corporation. One of the key features of SQL Server is its ability to create and manage indexes. An index is a data structure that improves the performance of database queries by allowing the database engine to quickly locate the data that matches a specific query. In this blog post, we will discuss SQL Server indexes, their types, how they work, and use cases.</p><p><strong>What is an index in SQL Server?</strong></p><p>An index in SQL Server is a data structure that improves the performance of database queries by allowing the database engine to quickly locate the data that matches a specific query. <strong><em>An index is created on one or more columns of a table, and it stores the values of those columns along with a pointer to the corresponding rows in the table.</em></strong></p><p><strong>How do indexes work in SQL Server?</strong></p><p>When a query is executed in SQL Server, the database engine looks for the data that matches the query. If an index exists on the columns used in the query, the database engine can use the index to quickly locate the data. The database engine reads the index to find the values that match the query, and then uses the pointers stored in the index to retrieve the corresponding rows from the table.</p><p><strong>Types of Indexes in SQL Server:</strong></p><p>SQL Server supports several types of indexes, including:</p><p><strong>Clustered Indexes:</strong> A clustered index is an index that determines the physical order of data in a table. A table can have only one clustered index, and it is created on the primary key column by default. A clustered index is useful when you frequently query the table based on the primary key column. Below is how we create the clustered index:</p><pre>CREATE CLUSTERED INDEX IX_Orders_OrderID ON Orders(OrderID);</pre><p><strong>Non-Clustered Indexes:</strong> A non-clustered index is an index that does not determine the physical order of data in a table. Instead, it stores the values of the indexed columns along with a pointer to the corresponding rows in the table. A table can have multiple non-clustered indexes. Below is how we create the clustered index:</p><pre>CREATE NONCLUSTERED INDEX IX_Customers_LastName ON Customers(LastName);</pre><p><strong>Unique Indexes:</strong> A unique index is an index that enforces the uniqueness of values in one or more columns of a table. A table can have multiple unique indexes.</p><pre>CREATE UNIQUE INDEX IX_Products_ProductCode ON Products(ProductCode);</pre><p><strong>Covering Indexes:</strong> A covering index is an index that includes all the columns that are required by a query. A covering index can improve query performance by allowing the database engine to retrieve all the required data from the index, rather than retrieving data from the table.</p><pre>CREATE NONCLUSTERED INDEX IX_Orders_CoveringIndex ON Orders(OrderID, CustomerID, OrderDate, OrderAmount);</pre><p><strong>Filtered Indexes:</strong> A filtered index is an index that includes only the rows of a table that meet a specific condition. A filtered index can improve query performance by reducing the number of rows that need to be scanned.</p><pre>CREATE NONCLUSTERED INDEX IX_Products_Category ON Products(ProductID) WHERE Category = &#39;Electronics&#39;;</pre><p><strong>How to choose the index type for a particular type of a data?</strong></p><blockquote>When choosing an index type, it’s important to consider the<strong> uniqueness and order</strong> of the data in the <strong>indexed column(s)</strong>. Here are some additional index types and their use cases based on the uniqueness and order of the data:</blockquote><p>Let’s discuss all of the possibles combinations with examples.</p><p><strong>Unique and Ordered Data:</strong> If the data in an indexed column is both <strong><em>unique and ordered</em></strong>, you should use a clustered index to improve performance. For example, if you have a table called <strong><em>“Students”</em></strong> with a column called <strong><em>“StudentID” </em></strong>that is both unique and ordered, you can create a clustered index on the <strong><em>“StudentID”</em></strong> column. The syntax to create a clustered index is as follows:</p><pre>CREATE CLUSTERED INDEX IX_Employees_Students ON Students(StudentID);</pre><p><strong>Unique and Unordered Data:</strong> If the data in an indexed column is <strong><em>unique but unordered</em></strong>, you should use a non-clustered index with the UNIQUE keyword to enforce uniqueness. For example, if you have a table called <strong><em>“Employees”</em></strong> with a column called<strong><em> “EmployeeNumber”</em></strong> that is unique but not ordered, you can create a non-clustered index with the <strong><em>UNIQUE</em></strong> keyword on the “<strong><em>EmployeeNumber”</em></strong> column.</p><pre>CREATE UNIQUE NONCLUSTERED INDEX IX_Employees_EmployeeNumber ON Employees(EmployeeNumber);</pre><p><strong>Non-Unique and Ordered Data: </strong>If the data in an indexed column is <strong><em>non-unique but ordered</em></strong>, you should use a non-clustered index to improve performance. For example, if you have a table called <strong><em>“Sales”</em></strong> with a column called <strong><em>“SaleDate”</em></strong> that is non-unique but ordered, you can create a non-clustered index on the <strong><em>“SaleDate”</em></strong> column. The syntax to create a non-clustered index is as follows:</p><pre>CREATE NONCLUSTERED INDEX IX_Orders_OrderDate ON Orders(OrderDate);</pre><p><strong>Non-Unique and Unordered Data: </strong>Non-Unique and Unordered Data: When data is non-unique and unordered, you should use a non-clustered index on the column that is frequently searched. For example, if you have a table called <strong><em>“Customers”</em></strong> with a column called <strong><em>“LastName”</em></strong> that contains non-unique last names and you frequently search for customers based on their last name, you can create a non-clustered index on the <strong><em>“LastName”</em></strong> column as follows:</p><pre>CREATE NONCLUSTERED INDEX IX_Customers_LastName ON Customers(LastName);</pre><p><strong>Use Cases of SQL Server Indexes:</strong></p><ol><li><strong>Improving Query Performance:</strong> The primary use case of SQL Server indexes is to improve query performance. By creating indexes on frequently queried columns, you can reduce the time it takes to retrieve data from a table.</li><li><strong>Enforcing Data Integrity:</strong> SQL Server indexes can be used to enforce data integrity by creating unique indexes on columns that should contain unique values. This ensures that duplicate values are not entered into the table.</li><li><strong>Partitioning Large Tables:</strong> SQL Server indexes can be used to partition large tables, which can improve query performance by reducing the amount of data that needs to be scanned. By creating indexes on the partitioning column, you can ensure that data is evenly distributed across the partitions.</li><li><strong>Joining Tables:</strong> SQL Server indexes can be used to join tables, which can improve query performance by reducing the number of rows that need to be scanned. By creating indexes on the join columns, you can ensure that the join operation is performed efficiently.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98e51a1de863" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Temporary Tables in SQL Server]]></title>
            <link>https://medium.com/@rajausmanahmedkhan/temporary-tables-in-sql-server-3f2d9089d3cc?source=rss-df806577571a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f2d9089d3cc</guid>
            <category><![CDATA[localtemptables]]></category>
            <category><![CDATA[global]]></category>
            <category><![CDATA[temporary-tables]]></category>
            <category><![CDATA[temp-table]]></category>
            <category><![CDATA[sql-server]]></category>
            <dc:creator><![CDATA[Usman Ahmed]]></dc:creator>
            <pubDate>Sun, 12 Mar 2023 18:48:19 GMT</pubDate>
            <atom:updated>2023-03-12T18:55:12.643Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cg4jeBuuB6VX6KWJh6RmXg.jpeg" /></figure><p>A TempTable, or temporary table, is a type of table in SQL Server that is created and exists only for the duration of a database session. They are stored in <strong><em>tempdb </em></strong>and can be used to store intermediate results during complex queries or for other purposes, such as temporary storage of data for a specific process or report.</p><p><strong>There are two types of Temporary Tables:</strong></p><ol><li>Local Temp Table</li><li>Global Temp Table</li></ol><p>Local temporary tables are only visible to the current session and are dropped automatically when the session is closed. Global temporary tables are visible to all sessions and are dropped automatically when the last session referencing the table is closed. The concept of a session is explained at the end of this article.</p><blockquote>To create a TempTable in SQL Server, you use the CREATE TABLE statement with the <strong># </strong>symbol before the table name for local temporary tables, and <strong><em>##</em></strong> for global temporary tables.</blockquote><p>Here’s an example:</p><pre>-- create a local temporary table<br>CREATE TABLE #TempTable (<br>    ID INT PRIMARY KEY,<br>    Name VARCHAR(50)<br>);<br><br>-- insert some data into the temporary table<br>INSERT INTO #TempTable (ID, Name)<br>VALUES (1, &#39;John&#39;), (2, &#39;Jane&#39;), (3, &#39;Bob&#39;);<br><br>-- select data from the temporary table<br>SELECT * FROM #TempTable;<br><br>-- drop the temporary table (this happens automatically when the session is closed)<br>DROP TABLE #TempTable;</pre><p>And here’s an example of creating a global temporary table:</p><pre>-- create a global temporary table<br>CREATE TABLE ##GlobalTempTable (<br>    ID INT PRIMARY KEY,<br>    Name VARCHAR(50)<br>);<br><br>-- insert some data into the global temporary table<br>INSERT INTO ##GlobalTempTable (ID, Name)<br>VALUES (1, &#39;John&#39;), (2, &#39;Jane&#39;), (3, &#39;Bob&#39;);<br><br>-- select data from the global temporary table<br>SELECT * FROM ##GlobalTempTable;<br><br>-- drop the global temporary table (this happens automatically when the last session referencing the table is closed)<br>DROP TABLE ##GlobalTempTable;</pre><p>Overall, TempTables can be a useful tool for managing temporary data in SQL Server. Just remember to use them appropriately and drop them when they are no longer needed to avoid cluttering up the <strong><em>tempdb </em></strong>database.</p><p><strong>What is a session in Database</strong></p><p>In the context of SQL Server, a session refers to a connection between a client application and an instance of SQL Server. When a client application connects to SQL Server, it establishes a session that allows the application to send requests to the server and receive results.</p><p>Each session has a unique identifier that is assigned by SQL Server when the connection is established. This identifier can be used to track and manage the session, such as identifying which queries are being executed by which session.</p><p>Here is an example of a session:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*gCUfCCzCfmfmWvN_t4T9QA.jpeg" /></figure><blockquote>Whenever we close this current query the temp table session is over and all the temp tables created in this query will be destroyed because the session is over for those temp tables. In comparison all global temp tables will retain until the last query window gets closed by the user.</blockquote><p>It’s important to note that a session is not the same as a transaction. While a session represents a connection between a client application and SQL Server, a transaction is a series of one or more database operations that are executed as a single unit of work. Multiple transactions can be executed within a single session.</p><p>Sessions can be managed and monitored using SQL Server Management Studio (SSMS) or other SQL Server monitoring tools. For example, you can use SSMS to view active sessions, terminate sessions, and view details about the queries being executed by each session.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f2d9089d3cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use ChatGPT API]]></title>
            <link>https://medium.com/@rajausmanahmedkhan/how-to-use-chatgpt-api-988a8015c773?source=rss-df806577571a------2</link>
            <guid isPermaLink="false">https://medium.com/p/988a8015c773</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[chatgptapi]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[Usman Ahmed]]></dc:creator>
            <pubDate>Fri, 10 Mar 2023 22:48:06 GMT</pubDate>
            <atom:updated>2023-03-10T22:48:06.973Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IIRwxWOLKFs2AsHwyJ7M3w.jpeg" /></figure><p>ChatGPT is a language model developed by OpenAI that can generate human-like responses to a given prompt or message. It can be used for a variety of natural language processing tasks such as language translation, text summarization, and chatbot development.</p><p>In this blog post, we’ll be exploring how to use the ChatGPT API to generate responses to a given prompt. We’ll start by discussing how to set up the API and then move on to a code example that demonstrates how to use the API to generate responses.</p><h3>Setting up the ChatGPT API</h3><p>To use the ChatGPT API, you’ll need an API key, which you can obtain by signing up for OpenAI’s API service. Once you have your API key, you can use it to make API requests to the ChatGPT API.</p><p>The ChatGPT API uses the OpenAI API, so you’ll need to install the OpenAI API package using pip. You can do this by running the following command:</p><pre>pip install openai</pre><p>Once you have the OpenAI API package installed, you can use it to make API requests to the ChatGPT API.</p><h3>Code Example</h3><p>Now let’s take a look at a code example that demonstrates how to use the ChatGPT API to generate responses. In this example, we’ll be using Python to make API requests.</p><p>First, let’s import the necessary packages:</p><pre>import openai<br>import os</pre><p>Next, we’ll set our OpenAI API key as an environment variable. This is done to protect your API key from being accidentally exposed in your code.</p><pre>openai.api_key = os.environ[&quot;OPENAI_API_KEY&quot;]</pre><p>Now that we’ve set our API key, let’s create a function that uses the ChatGPT API to generate a response to a given prompt.</p><pre>def generate_response(prompt):<br>    response = openai.Completion.create(<br>        engine=&quot;davinci&quot;,<br>        prompt=prompt,<br>        max_tokens=1024,<br>        n=1,<br>        stop=None,<br>        temperature=0.7,<br>    )<br><br>    message = response.choices[0].text.strip()<br>    return message</pre><p>In this function, we’re using the openai.Completion.create() method to generate a response to a given prompt. We’re specifying the following parameters:</p><blockquote><strong>engine: </strong>The language model we want to use. In this case, we’re using the davinci engine, which is the most advanced model available.<br><strong>prompt:</strong> The text prompt we want to generate a response to.<br>max_tokens: The maximum number of tokens the model should generate in the response.<br><strong>n:</strong> The number of responses we want the model to generate. In this case, we’re generating only one response.<br><strong>stop:</strong> A list of tokens that, when generated by the model, indicate that the response is complete. We’re not specifying any stop tokens in this example.<br><strong>temperature:</strong> A value between 0 and 1 that controls the “creativity” of the model. A higher temperature value will result in more creative responses.<br>Once we’ve generated a response, we’re extracting the message from the response using the response.choices[0].text.strip() method and returning it.</blockquote><p>Let’s test our function with a prompt:</p><pre>prompt = &quot;Hello, how are you doing today?&quot;<br>response = generate_response(prompt)<br>print(response)</pre><p>When we run this code, we should see a generated response to our prompt.</p><h3>Conclusion</h3><p>In this blog post, we’ve explored how to use the ChatGPT API to generate responses to a given prompt. We’ve discussed how to set up the API and use it for our purpose.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=988a8015c773" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DDL vs DML vs DCL (A Brief Intro)]]></title>
            <link>https://medium.com/@rajausmanahmedkhan/ddl-vs-dml-vs-dcl-a-brief-intro-b16089d8b243?source=rss-df806577571a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b16089d8b243</guid>
            <category><![CDATA[dml]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[databases-big-data]]></category>
            <category><![CDATA[ddl]]></category>
            <category><![CDATA[dcl]]></category>
            <dc:creator><![CDATA[Usman Ahmed]]></dc:creator>
            <pubDate>Thu, 09 Mar 2023 19:53:18 GMT</pubDate>
            <atom:updated>2023-03-09T19:53:18.836Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AZJ1OeUD2738bXXBfHzaFQ.jpeg" /></figure><p>When it comes to working with databases, there are three important concepts to understand: Data Definition Language (DDL), Data Manipulation Language (DML), and Data Control Language (DCL). These concepts are essential for managing and manipulating data within a database.</p><p>In this blog post, we will explore each of these concepts in detail, including what they are, how they work, and some examples of their usage.</p><p><strong>Data Definition Language (DDL):</strong></p><p>Data Definition Language (DDL) is a set of commands used to define the structure of a database. These commands create, modify, and delete database objects such as tables, views, indexes, and procedures. DDL statements are used to define the database schema, which describes how data is organized and stored in the database.</p><p>Here are some examples of DDL statements in T-SQL:</p><p><strong>CREATE TABLE:</strong> This statement is used to create a new table in the database. For example:</p><pre>CREATE TABLE Customers (<br>  CustomerID int NOT NULL,<br>  FirstName varchar(255),<br>  LastName varchar(255),<br>  PRIMARY KEY (CustomerID)<br>);</pre><blockquote>This creates a table called “<strong>Customers</strong>” with three columns: “<strong>CustomerID</strong>”, “<strong>FirstName</strong>”, and “<strong>LastName</strong>”. The “NOT NULL” constraint ensures that the “CustomerID” column must always have a value, and the “PRIMARY KEY” constraint specifies that “CustomerID” is the primary key of the table.</blockquote><p><strong>ALTER TABLE:</strong> This statement is used to modify an existing table in the database. For example:</p><pre>ALTER TABLE Customers<br>ADD Email varchar(255);</pre><blockquote><em>This adds a new column called “Email” to the “Customers” table.</em></blockquote><p><strong>DROP TABLE:</strong> This statement is used to delete a table from the database. For example:</p><pre>DROP TABLE Customers;</pre><blockquote><em>This deletes the “Customers” table from the database.</em></blockquote><p><strong>Data Manipulation Language (DML):</strong></p><p>In T-SQL, Data Manipulation Language (DML) is used to manipulate the data in the database. Here are some examples of DML statements in T-SQL:</p><p><strong>INSERT INTO:</strong> This statement is used to insert new rows into a table. For example:</p><pre>INSERT INTO Customers (CustomerID, FirstName, LastName, Email)<br>VALUES (1, &#39;John&#39;, &#39;Doe&#39;, &#39;johndoe@example.com&#39;);</pre><blockquote>This inserts a new row into the “Customers” table with the specified values.</blockquote><p><strong>UPDATE:</strong> This statement is used to update existing rows in a table. For example:</p><pre>UPDATE Customers<br>SET FirstName = &#39;Jane&#39;<br>WHERE CustomerID = 1;</pre><blockquote>This updates the “FirstName” column of the row with “CustomerID” = 1 to “Jane”.</blockquote><p><strong>DELETE:</strong> This statement is used to delete rows from a table. For example:</p><pre>DELETE FROM Customers<br>WHERE LastName = &#39;Doe&#39;;</pre><blockquote>This deletes all rows from the “Customers” table where the “LastName” column is equal to “Doe”.</blockquote><p><strong>Data Control Language (DCL)</strong></p><p>In T-SQL, Data Control Language (DCL) is used to control access to the database. Here are some examples of DCL statements in T-SQL:</p><p><strong>GRANT: </strong>This statement is used to grant permissions to a user or role. For example:</p><pre>GRANT SELECT, INSERT, UPDATE, DELETE ON Customers TO SalesUser;</pre><blockquote>This grants the “SalesUser” role permission to select, insert, update, and delete data in the “Customers” table.</blockquote><p><strong>REVOKE:</strong> This statement is used to revoke permissions from a user or role. For example:</p><pre>REVOKE SELECT ON Customers FROM MarketingUser;</pre><blockquote>This revokes the “MarketingUser” role’s permission to select data from the “Customers” table.</blockquote><p><strong>DENY:</strong> This statement is used to deny permissions to a user or role. For example:</p><pre>DENY SELECT ON Customers TO TraineeUser;</pre><blockquote>This denies the “TraineeUser” role permission to select data from the “Customers” table, even if they are granted permission by other means.</blockquote><p>In summary, the three important concepts when working with databases are Data Manipulation Language (DML), and Data Definition Language (DDL), and Data Control Language (DCL). Here’s a quick summary of each concept:</p><ol><li>Data Definition Language (DDL) DDL is used to define the structure of the database, including creating, modifying, and deleting tables, views, indexes, and other database objects. Some common DDL commands include CREATE, ALTER, and DROP.</li><li>Data Manipulation Language (DML) DML is used to manipulate the data within the database. It includes commands like SELECT, INSERT, UPDATE, and DELETE to retrieve, add, modify, or remove data from a table or view.</li><li>Data Control Language (DCL) DCL is used to control access to the database, including granting or revoking permissions to users and roles. Some common DCL commands include GRANT, REVOKE, and DENY.</li></ol><p>By understanding these three concepts and how they work together, you can effectively manage and manipulate data within a database, ensuring that it remains secure, well-organized, and efficient.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b16089d8b243" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Types of Joins in Databases]]></title>
            <link>https://medium.com/@rajausmanahmedkhan/self-types-of-joins-in-databases-d4ad0c05105b?source=rss-df806577571a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4ad0c05105b</guid>
            <category><![CDATA[join]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[sql-joins]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[typesofjoins]]></category>
            <dc:creator><![CDATA[Usman Ahmed]]></dc:creator>
            <pubDate>Wed, 08 Mar 2023 20:26:59 GMT</pubDate>
            <atom:updated>2023-03-08T20:27:48.996Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="SQL Databases" src="https://cdn-images-1.medium.com/max/1024/1*cg4jeBuuB6VX6KWJh6RmXg.jpeg" /></figure><p>SQL joins are used to combine rows from two or more tables based on a related column between them. There are several types of joins in SQL, including inner join, left join, right join, and full outer join. In this blog post, we’ll take a closer look at each of these joins and provide examples of how they work.</p><p><strong>Inner Join:</strong> An inner join returns only the rows that have matching values in both tables. It can be used to combine data from two tables into one table where both tables have common values in a specific column.</p><figure><img alt="Inner Join" src="https://cdn-images-1.medium.com/max/500/1*osdGBVEpVyYjjmNsA1c0BQ.png" /></figure><blockquote>For example, let’s say we have two tables: <strong>Customers</strong> and <strong>Orders</strong>. Customers table has columns such as <strong>customer_id, customer_name, and customer_address</strong>. Orders table has columns such as <strong>order_id, order_date, and customer_id.</strong></blockquote><p>Here’s an example SQL query that uses an inner join to combine the two tables based on the common customer_id column:</p><pre>SELECT *<br>FROM Customers AS C<br>INNER JOIN Orders AS O<br>ON C.customer_id = O.customer_id;</pre><p>In this query, the INNER JOIN keyword is used to combine the two tables. The ON keyword specifies the column to use for the join.</p><p><strong>Left Join:</strong> A left join returns all the rows from the left table (the first table specified in the query) and the matching rows from the right table. If there are no matching rows in the right table, the result will still include the row from the left table but with null values for the columns from the right table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*u0gtP4V2OqQkwg2TweduZQ.png" /></figure><p>Here’s an example SQL query that uses a left join to combine the two tables:</p><pre>SELECT *<br>FROM Customers<br>LEFT JOIN Orders<br>ON Customers.customer_id = Orders.customer_id;</pre><p>In this query, the LEFT JOIN keyword is used to combine the two tables. The result will include all the rows from the Customers table, and the matching rows from the Orders table. If there are no matching rows in the Orders table, the result will still include the row from the Customers table with null values for the columns from the Orders table.</p><p><strong>Right Join:</strong> A right join returns all the rows from the right table (the second table specified in the query) and the matching rows from the left table. If there are no matching rows in the left table, the result will still include the row from the right table but with null values for the columns from the left table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*8oOHwxlmCm3dwNkv-ghp9Q.png" /></figure><p>Here’s an example SQL query that uses a right join to combine the two tables:</p><pre>SELECT *<br>FROM Customers<br>RIGHT JOIN Orders<br>ON Customers.customer_id = Orders.customer_id;</pre><p>In this query, the RIGHT JOIN keyword is used to combine the two tables. The result will include all the rows from the Orders table, and the matching rows from the Customers table. If there are no matching rows in the Customers table, the result will still include the row from the Orders table with null values for the columns from the Customers table.</p><p><strong>Full Join / Full Outer Join: </strong>A full outer join returns all the rows from both tables, including the rows that do not have matching values in the other table. If there are no matching rows in either table, the result will still include the rows from both tables with null values for the columns from the other table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*2Wk0Iskegrv6HRRsgT4ALg.png" /></figure><p>Here’s an example SQL query that uses a full outer join to combine the two tables:</p><pre>SELECT *<br>FROM Customers<br>FULL OUTER JOIN Orders<br>ON Customers.customer_id = Orders.customer_id;</pre><p>In this query, the FULL OUTER JOIN keyword is used to combine the two tables. The result will include all the rows from both the Customers table and the Orders table. If there are no matching rows in either table, the result will still include the rows from both tables with null values for the columns from the other table.</p><p><strong>Self Join:</strong> A self join is a type of join in SQL where a table is joined with itself. This can be useful when you have a table with <strong>hierarchical data</strong>, where each row has a parent or child relationship with other rows in the same table. By joining the table with itself, you can retrieve information about these relationships.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*8VN-dnzHr11Y9oR1iMkrfQ.png" /></figure><p>Here’s an example of a self join:</p><blockquote>Let’s say you have a table called Employees, with columns for <strong>EmployeeID,</strong> <strong>FirstName</strong>, <strong>LastName</strong>, and ManagerID. The ManagerID column contains the EmployeeID of the employee’s manager. You can use a self join to retrieve the names of each employee and their manager’s name.</blockquote><pre>SELECT e.FirstName AS EmployeeName, m.FirstName AS ManagerName<br>FROM Employees e<br>INNER JOIN Employees m<br>ON e.ManagerID = m.EmployeeID;</pre><p>In this query, the Employees table is joined with itself using the INNER JOIN keyword. The join condition is e.ManagerID = m.EmployeeID, which means that the ManagerID column in the Employees table is matched with the EmployeeID column in the self-joined copy of the Employees table.</p><p>The result of this query will be a table with two columns: EmployeeName and ManagerName. Each row will contain the name of an employee and their manager’s name. If an employee does not have a manager (i.e., their ManagerID is null), that row will not be included in the result.</p><p><strong>Cross Join / Cartesian Product:</strong> A cross join, also known as a cartesian product, is a type of join in SQL that returns the combination of each row from two tables. The result of a cross join is a table with the number of rows equal to the number of rows in the first table multiplied by the number of rows in the second table.</p><figure><img alt="Cross Join" src="https://cdn-images-1.medium.com/max/450/1*dIYKKKV1yKOYYeCUbpnCng.png" /></figure><p>Here’s an example of a cross join:</p><blockquote>Let’s say you have two tables: <strong>Customers </strong>and <strong>Products</strong>. The Customers table has columns for<strong> CustomerID, FirstName, and LastName</strong>. The Products table has columns for <strong>ProductID and ProductName</strong>. You can use a cross join to retrieve a list of all the possible combinations of customers and products.</blockquote><pre>SELECT *<br>FROM Customers<br>CROSS JOIN Products;</pre><p>In this query, the Customers table is joined with the Products table using the CROSS JOIN keyword. This will return a table with all the possible combinations of customers and products.</p><blockquote>The result of this query will be a table with columns for CustomerID, FirstName, LastName, ProductID, and ProductName. Each row will represent a combination of one customer and one product.</blockquote><p>It’s important to note that a cross join can quickly become computationally expensive when dealing with large tables, as it creates a result set with a number of rows equal to the product of the number of rows in each table. Therefore, it’s generally not recommended to use a cross join unless it’s absolutely necessary.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4ad0c05105b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQL Query Execution Order(Everyone Needs to Know)]]></title>
            <link>https://medium.com/@rajausmanahmedkhan/sql-query-execution-order-everyone-needs-to-know-5c9d5dd9f0c?source=rss-df806577571a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c9d5dd9f0c</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[structured-query-language]]></category>
            <category><![CDATA[t-sql]]></category>
            <category><![CDATA[execution-order]]></category>
            <category><![CDATA[sql-execution]]></category>
            <dc:creator><![CDATA[Usman Ahmed]]></dc:creator>
            <pubDate>Sat, 04 Mar 2023 17:45:13 GMT</pubDate>
            <atom:updated>2023-03-04T17:45:13.383Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="SQL" src="https://cdn-images-1.medium.com/max/1024/1*D3TnNCuk-6rqYbOTUAXpuA.jpeg" /></figure><p>SQL execution order, also known as query processing order, refers to the order in which different components of a SQL statement are executed by SQL Server. Understanding the execution order is essential for writing efficient queries and troubleshooting performance issues.</p><p>The T-SQL execution order is as follows:</p><ol><li><strong>FROM </strong>clause: The FROM clause is the first component of a SELECT statement to be executed. It specifies the tables from which the data will be retrieved.</li><li><strong>JOIN </strong>clause: If the query involves joining two or more tables, the JOIN clause is executed next. This clause combines the data from multiple tables into a single result set.</li><li><strong>WHERE</strong> clause: The WHERE clause is executed after the FROM and JOIN clauses. It filters the rows based on the specified conditions.</li><li><strong>GROUP BY</strong> clause: If the query involves grouping the rows based on one or more columns, the GROUP BY clause is executed next. This clause groups the rows into subsets based on the specified columns.</li><li><strong>HAVING</strong> clause: The HAVING clause is executed after the GROUP BY clause. It filters the groups based on the specified conditions.</li><li><strong>SELECT</strong> clause: The SELECT clause is executed after all the previous clauses. It selects the columns to be included in the result set and applies any functions or expressions.</li><li><strong>ORDER BY</strong> clause: If the query involves sorting the rows based on one or more columns, the ORDER BY clause is executed last. This clause sorts the rows in the result set based on the specified columns and their sort order.</li></ol><blockquote>It’s important to note that not all SQL statements have all these components. For example, an INSERT statement doesn’t have a FROM or a WHERE clause, while a DELETE statement doesn’t have a SELECT or a GROUP BY clause.</blockquote><p>Certainly, here’s an example query that demonstrates the T-SQL execution order:</p><pre>SELECT <br>    CustomerName, <br>    COUNT(OrderID) AS NumOrders,<br>    AVG(OrderTotal) AS AvgTotal<br>FROM <br>    Customers<br>    JOIN Orders ON Customers.CustomerID = Orders.CustomerID<br>WHERE <br>    Country = &#39;USA&#39;<br>GROUP BY <br>    CustomerName<br>HAVING <br>    COUNT(OrderID) &gt; 5<br>ORDER BY <br>    AvgTotal DESC;</pre><p>In this query, the T-SQL execution order is as follows:</p><ol><li><strong>FROM </strong>clause: The FROM clause specifies two tables, Customers and Orders, which are joined based on the CustomerID column.</li><li><strong>JOIN </strong>clause: The JOIN clause combines the data from the Customers and Orders tables into a single result set.</li><li><strong>WHERE </strong>clause: The WHERE clause filters the rows to include only those with a Country value of &#39;USA&#39;.</li><li><strong>GROUP BY </strong>clause: The GROUP BY clause groups the rows by CustomerName.</li><li><strong>HAVING</strong> clause: The HAVING clause filters the groups to include only those with more than 5 orders.</li><li><strong>SELECT </strong>clause: The SELECT clause selects the CustomerName column, counts the OrderID column and aliases it as NumOrders, and calculates the average of the OrderTotal column and aliases it as AvgTotal.</li><li><strong>ORDER BY</strong> clause: The ORDER BY clause sorts the result set in descending order based on the AvgTotal column.</li></ol><blockquote>By understanding the T-SQL execution order, you can write queries that are optimized for performance and produce the expected results. In addition to the above execution order, SQL Server uses several optimization techniques to improve query performance. These techniques include:</blockquote><ol><li><strong>Query optimization:</strong> SQL Server analyzes the query and generates an execution plan that uses the most efficient algorithms and data access methods.</li><li><strong>Indexing:</strong> SQL Server uses indexes to speed up data retrieval and filtering.</li><li><strong>Caching:</strong> SQL Server caches frequently executed queries and their results to avoid the overhead of re-executing them.</li><li><strong>Parallelism:</strong> SQL Server can execute multiple parts of a query simultaneously to take advantage of multi-core processors.</li></ol><p>In conclusion, understanding the T-SQL execution order is essential for writing efficient queries and troubleshooting performance issues. By following the execution order and optimizing your queries, you can improve the performance of your applications and reduce the load on your database server.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c9d5dd9f0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microsoft Power BI (A Breif Overview)]]></title>
            <link>https://medium.com/@rajausmanahmedkhan/microsoft-power-bi-a-breif-overview-881c9167f426?source=rss-df806577571a------2</link>
            <guid isPermaLink="false">https://medium.com/p/881c9167f426</guid>
            <category><![CDATA[microsoft-power-bi]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-analysis-tool]]></category>
            <category><![CDATA[bi]]></category>
            <dc:creator><![CDATA[Usman Ahmed]]></dc:creator>
            <pubDate>Sun, 26 Feb 2023 13:41:55 GMT</pubDate>
            <atom:updated>2023-02-26T13:41:55.857Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Power BI" src="https://cdn-images-1.medium.com/max/1024/1*8tmEXsxXIVHLeAOirh7cTg.jpeg" /></figure><p>Power BI is a business analytics service provided by Microsoft that enables users to visualize and analyze data from various sources. It allows users to create interactive reports, dashboards, and data visualizations that provide insights into business data.</p><h4><strong>Power BI Connectors</strong></h4><p>Power BI connectors are software components that enable Power BI to connect to a variety of data sources. These connectors allow users to import data into Power BI from various sources, including databases, cloud-based services, and third-party applications. Some common examples of Power BI connectors include:</p><figure><img alt="Power BI Data Source Connectors" src="https://cdn-images-1.medium.com/max/1024/1*hKj6rlarBElWc3k5zKCPIA.png" /></figure><ol><li><strong>SQL Server:</strong> A connector that enables Power BI to connect to SQL Server databases.</li><li><strong>Excel:</strong> A connector that allows Power BI to connect to Excel spreadsheets and workbooks.</li><li><strong>Salesforce:</strong> A connector that enables Power BI to connect to Salesforce CRM data.</li><li><strong>Google Analytics:</strong> A connector that allows Power BI to connect to Google Analytics data.</li><li><strong>SharePoint:</strong> A connector that enables Power BI to connect to SharePoint Online and on-premises data.</li><li><strong>Power Automate:</strong> A connector that allows Power BI to connect to Power Automate flows to import data from various sources.</li><li><strong>JSON:</strong> A connector that enables Power BI to connect to JSON data sources.</li><li><strong>Web:</strong> A connector that allows Power BI to connect to web pages and web-based data sources.</li></ol><p>There are many other connectors available, including connectors for Microsoft Dynamics 365, Azure, Facebook, Twitter, and many more. These connectors make it easy for users to import data from various sources and create powerful data visualizations and dashboards in Power BI.</p><h4><strong>DAX vs M Query</strong></h4><p>DAX (Data Analysis Expressions) and M query are both languages used in Power BI for data manipulation and transformation, but they serve different purposes.</p><blockquote>DAX is a formula language used to create custom calculations, aggregations, and measures within Power BI. It is used to create complex calculations based on data in the data model, such as calculated columns, calculated tables, and measures. DAX is a powerful and flexible language that allows users to create complex calculations using a simple syntax.</blockquote><blockquote>Here is an example of a DAX function which calculates the sum of Sales Amount for the products of the red color.</blockquote><pre>CALCULATE ( SUM(Sales Amount), &#39;Product&#39;[Color] = &quot;Red&quot; )</pre><blockquote>M query, on the other hand, is a functional programming language used for data transformation and manipulation. It is used to extract, transform, and load (ETL) data from various sources before it is loaded into the data model. M query allows users to perform complex data transformations, such as merging data from multiple sources, filtering and transforming data, and splitting data into different tables.</blockquote><blockquote>Here is an example of the M Query to rename multiple columns.</blockquote><pre><br>RenameCols = Table.RenameColumns(PromoteNames, {{&quot;&quot;, &quot;PsgrID&quot;}, <br>  {&quot;PClass&quot;, &quot;PsgrClass&quot;}, {&quot;Sex&quot;, &quot;Gender&quot;}})</pre><p>In summary, DAX is used to perform calculations on data within the data model, while M query is used to transform and shape data before it is loaded into the data model. Both languages are important tools for Power BI users, and they can be used together to create powerful data models and visualizations.</p><h4><strong>Power Query</strong></h4><p>Power Query is a data transformation and data preparation tool provided by Microsoft that is available in several products, including Excel, Power BI, and Azure. In Power BI, Power Query is used to transform and shape data before it is loaded into the data model.</p><p>With Power Query in Power BI, users can connect to various data sources, including Excel spreadsheets, CSV files, databases, and cloud-based services, and perform transformations on the data. Some common transformations include filtering, sorting, merging, and pivoting data.</p><p>Power Query provides a visual interface for creating data transformations, which makes it easy for users with little to no coding experience to perform complex data transformations. It also includes a powerful scripting language called M, which allows users to create custom transformations and automate repetitive tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*ynVoP50a2FjcIW9pFkGobw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eXUxFUoIopzIDXnKxmLXAg.png" /></figure><p>Once the data has been transformed using Power Query, it can be loaded into the data model in Power BI, where it can be used to create visualizations and reports.</p><p>In summary, Power Query is a powerful tool in Power BI that allows users to transform and shape data before it is loaded into the data model. It provides a user-friendly interface and a powerful scripting language to perform complex transformations on data from various sources.</p><h3><strong>Summary</strong></h3><p>Power BI has several strengths that make it a popular and powerful tool for data analytics and business intelligence. Some of its key strengths include:</p><ol><li><strong>Easy to Use:</strong> Power BI has a user-friendly interface that allows users to create visualizations and reports without needing extensive technical expertise. Its drag-and-drop interface makes it easy to create interactive visualizations, and its natural language query feature allows users to ask questions and get answers quickly.</li><li><strong>Powerful Data Transformation:</strong> Power BI includes Power Query, a data transformation tool that allows users to connect to a wide range of data sources, transform and clean data, and create powerful data models. Power Query is easy to use and provides a range of transformation capabilities that allow users to get the most out of their data.</li><li><strong>Wide Range of Connectors:</strong> Power BI has a wide range of connectors that allow users to connect to a variety of data sources, including databases, cloud-based services, and third-party applications. This makes it easy to integrate data from multiple sources and create comprehensive reports and dashboards.</li><li><strong>Collaboration:</strong> Power BI allows teams to collaborate on reports and visualizations in real-time, making it easy for users to share insights and work together on data projects.</li><li><strong>Scalability:</strong> Power BI is designed to handle large volumes of data and can scale to meet the needs of businesses of all sizes. It also integrates with other Microsoft products such as Azure and Excel, providing a seamless end-to-end data analytics solution.</li></ol><p>In summary, Power BI’s strengths include its ease of use, powerful data transformation capabilities, wide range of connectors, collaboration features, and scalability, making it a powerful tool for data analytics and business intelligence.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=881c9167f426" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Concept of the Self Service BI]]></title>
            <link>https://medium.com/@rajausmanahmedkhan/concept-of-the-self-service-bi-d216f5f9340a?source=rss-df806577571a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d216f5f9340a</guid>
            <category><![CDATA[bi]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[self-service-bi]]></category>
            <category><![CDATA[data-analytics]]></category>
            <dc:creator><![CDATA[Usman Ahmed]]></dc:creator>
            <pubDate>Sun, 26 Feb 2023 10:27:57 GMT</pubDate>
            <atom:updated>2023-02-26T10:32:34.673Z</atom:updated>
            <content:encoded><![CDATA[<p>Self-Service Business Intelligence (BI) is a technology-driven approach to data analysis that enables users to generate insights and reports without the need for IT intervention. It is a rapidly growing field that allows users to quickly access, analyze, and visualize data in order to make informed business decisions. In this blog post, we will explore the concept of self-service BI, its benefits, and how it can be implemented.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lc9qCvDFqOd9Wk3vTFooLg.jpeg" /></figure><h4>What is Self-Service BI?</h4><p>Traditionally, business intelligence tools were designed for use by data analysts or IT professionals who were trained to use them. Self-service BI, on the other hand, enables business users to explore and analyze data on their own, without having to rely on IT to create reports or queries.</p><p>Self-service BI tools typically feature a user-friendly interface that allows users to access and analyze data using a drag-and-drop approach. Users can select the data they want to analyze and then choose from a range of visualizations to create reports or dashboards. These reports can be easily shared with others in the organization, allowing for greater collaboration and faster decision-making.</p><h4>Benefits of Self-Service BI</h4><p>There are several benefits to implementing self-service BI within an organization:</p><ol><li><strong>Faster Decision-Making: </strong>With self-service BI, business users can quickly access the data they need to make informed decisions. This can help to speed up decision-making processes, allowing organizations to respond more quickly to changing market conditions.</li><li><strong>Increased Collaboration:</strong> Self-service BI allows for greater collaboration between different departments and teams within an organization. Business users can share their reports and insights with others, helping to promote cross-functional communication and collaboration.</li><li><strong>Reduced IT Dependence:</strong> Self-service BI tools can reduce the burden on IT departments, as business users are able to access and analyze data on their own. This frees up IT resources for other tasks, while also reducing the time and cost associated with creating custom reports.</li><li><strong>Greater Insight:</strong> Self-service BI enables business users to explore data in greater detail, leading to deeper insights and better decision-making. By providing users with access to more data, organizations can gain a more complete understanding of their business operations.</li></ol><h4>Implementing Self-Service BI</h4><p>Implementing self-service BI within an organization requires a well-planned approach. Here are some steps to consider:</p><ol><li><strong>Identify Business Needs:</strong> The first step is to identify the business needs that self-service BI can address. This may involve conducting a needs assessment to identify the types of data that business users require to make informed decisions.</li><li><strong>Choose the Right Tools: </strong>There are many self-service BI tools available on the market. It is important to choose a tool that is user-friendly, scalable, and integrates with existing systems. Some of the best examples right now in the market are Power BI, Tableau, Amazon QuickSight, etc.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0OgiXZ6l0VKrUXzjA2MYIw.png" /></figure><ol><li><strong>Ensure Data Quality:</strong> Self-service BI relies on accurate and reliable data. It is important to ensure that data is clean, consistent, and up-to-date before making it available to business users.</li><li><strong>Provide Training and Support:</strong> While self-service BI is designed to be user-friendly, it is still important to provide training and support to ensure that users are able to make the most of the tools available.</li></ol><h4><strong><em>Conclusion</em></strong></h4><p>Self-service BI is an exciting field that has the potential to transform the way organizations access and analyze data. By empowering business users to explore data on their own, organizations can gain greater insights, make faster decisions, and promote greater collaboration. With the right approach, self-service BI can help organizations to stay competitive and responsive to changing market conditions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d216f5f9340a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>