<?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 mayuri budake on Medium]]></title>
        <description><![CDATA[Stories by mayuri budake on Medium]]></description>
        <link>https://medium.com/@mayuribudake999?source=rss-351dcd99f67e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-xdYVZ6uheRnQWlz.jpg</url>
            <title>Stories by mayuri budake on Medium</title>
            <link>https://medium.com/@mayuribudake999?source=rss-351dcd99f67e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 13:27:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mayuribudake999/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[Partitioning in SQL Server 2008]]></title>
            <link>https://medium.com/@mayuribudake999/partitioning-in-sql-server-2008-b5a57ae2e27c?source=rss-351dcd99f67e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5a57ae2e27c</guid>
            <category><![CDATA[partition-function]]></category>
            <category><![CDATA[learn-sql]]></category>
            <category><![CDATA[partition-scheme]]></category>
            <category><![CDATA[sql-server-partition]]></category>
            <category><![CDATA[partitioning]]></category>
            <dc:creator><![CDATA[mayuri budake]]></dc:creator>
            <pubDate>Fri, 03 Jan 2020 12:37:50 GMT</pubDate>
            <atom:updated>2020-01-03T12:41:11.831Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>PARTITIONING IN SQL:</em></strong></p><ul><li>Partitioning is a feature designed to improve the performance of queries made against a very large table.</li><li>It works by having more than one subset of data for the same table. All the rows are not directly stored in the table, but they are distributed in different partitions of this table.</li><li>SQL Server only supports one type of partitioning, which is <strong><em>Range Partitions</em></strong>. This the partitioning strategy in which data is partitioned based on the range that the value of a particular field falls in.</li><li>The other partitioning types are hash, list,column etc. which are not supported currently in SQL Server but it supported in MySQL.</li><li>When we partition a table, we define on which portion of a table a particular row will be stored.</li><li>There are actually rules defined for ranges of data to fill a particular partition. These ranges are based on a particular column, this is called the <strong><em>Partition Key</em></strong>. These ranges are non-overlapping. To achieve this, a <strong><em>Partition Function</em></strong> and a <strong><em>Partition Scheme</em></strong> is defined.</li></ul><p><strong><em>PARTITION FUNCTIONS:</em></strong></p><ul><li>The Partition Function is the function that defines the number of partitions. One partition function can be used to partition a number of objects.</li><li>we can divide partition function into two types:</li></ul><ol><li><strong>Left:</strong> The first value is the maximum value of the first partition.</li><li><strong>Right:</strong> The first value is the minimum value of the second partition.</li></ol><p><strong><em>Syntax:-</em></strong></p><p>CREATE PARTITION FUNCTION Partition_Function_Name</p><p>(Input_Parameter_Type)</p><p>AS RANGE [ LEFT | RIGHT ]</p><p>FOR VALUES([boundary_value [ ,….N ] ] ) [ ; ]</p><p><strong><em>PARTITION SCHEME:</em></strong></p><ul><li>The partition scheme just like specifying an alignment for data i.e. it specifies the specific file groups used during partitioning an object.</li><li>Though it is possible to create all partitions on PRIMARY but it would be best if these different partitions are stored in a separate file groups.</li><li>This gives some performance improvement even in the case of single core computers. It would be best if these file groups are on different discs on a multi core processing machine.</li></ul><p><strong><em>Syntax:-</em></strong></p><p>CREATE PARTITION SCHEME Partition_Scheme_Name</p><p>AS PARTITION Partition_Function_Name</p><p>[ ALL ] TO ( { File_Group-Name | [ PRIMARY ] } [ ,….N ] ] ) [ ; ]</p><p><strong><em>PARTITIONED INDEX:</em></strong></p><ul><li>We can also partition our indexes, and this should contribute to improved performance.</li><li>If indexes are partitioned they serve as the local indexes for each partition.</li><li>It must be remembered that indexes can be partitioned using a different partition key than the table. The index can also have different numbers of partitions than the table.</li></ul><p><strong><em>Syntax:-</em></strong></p><p>CREATE NONCLUSTERED INDEX MyNonClusteredIndex ON Table_Name(Column_Name1) ON MyPartitionScheme( Column_Name2);</p><ul><li><strong>Example</strong></li></ul><p><strong><em>Steps for creating Partitioning</em></strong></p><ol><li>Right click on TableName → Storage → create partition</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*yNfCEcYkC0GuwegdXwzUIg.png" /></figure><p>2. When you select the above option a wizard dialog box appears, press the next button once.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*KR-HGJfHlSmKVFL1chIepQ.png" /></figure><p>3. Select the column on which you would like to create a partition and press next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*-XgnYX3LjUpoUMDfzJuxRg.png" /></figure><p>4. Provide the name of the partition function and press Next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*r_qpxx0lxkdhO6UHs_T2qQ.png" /></figure><p>5. Provide the name of the partition scheme and press next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*fF8mC3Ug1DeHTbtxdeN0bw.png" /></figure><p>6. You have to select the option Left Boundary or Right Boundary and then click the button that says Set Boundaries and Click on Estimate storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*yJ3Qkv4nR0YextfEzkPzFw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*tA-TcJMLVSyoeguRW9V4BA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*-ijA-ktJ36NQ2je8tlGNWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*O4vSjEBSj9Qi2RcgjlAudg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*v6yb7cegRlcd3zceOFjxag.png" /></figure><p><strong><em>If you are new to SQL refer Below video for better Understanding.</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuGlfP9o7kmY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FuGlfP9o7kmY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b108a31cf1ed747e6c45d31aa03bdf63/href">https://medium.com/media/b108a31cf1ed747e6c45d31aa03bdf63/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5a57ae2e27c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VIEW IN SQL SERVER]]></title>
            <link>https://medium.com/@mayuribudake999/view-in-sql-server-7860dc59a7b8?source=rss-351dcd99f67e------2</link>
            <guid isPermaLink="false">https://medium.com/p/7860dc59a7b8</guid>
            <category><![CDATA[index]]></category>
            <category><![CDATA[indexed-view]]></category>
            <category><![CDATA[learn-sql]]></category>
            <category><![CDATA[views]]></category>
            <category><![CDATA[sql-tutorial]]></category>
            <dc:creator><![CDATA[mayuri budake]]></dc:creator>
            <pubDate>Thu, 02 Jan 2020 07:35:46 GMT</pubDate>
            <atom:updated>2020-01-02T07:35:46.266Z</atom:updated>
            <content:encoded><![CDATA[<ul><li>View is a virtual table based on the result-set of an SQL statement.</li><li>It contains rows and columns.</li><li>We add SQL functions, WHERE, JOIN statements to a view.</li><li><strong><em>Syntax :</em></strong></li></ul><p>create view View_Name AS</p><p>SELECT Column_Name 1,Column_Name 2,……..Column_Name N</p><p>FROM Table_Name</p><p>WHERE Column_Name=value;</p><ul><li><strong><em>Example:</em></strong></li></ul><p>create view EmpCity AS</p><p>SELECT * FROM Employee</p><p>WHERE Employee_Address=’Sakinaka’;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/265/1*cnKVBei3_7SrBldWFSLxQQ.png" /><figcaption>Table and View</figcaption></figure><ul><li>Select data from View: select * from EmpCity</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*ydKnc6r5hJVlNfGsXRwfQg.png" /></figure><ul><li><strong><em>Syntax for drop view:</em></strong> Drop view View_Name;</li></ul><p><strong><em>STATISTICS IO in view:</em></strong></p><ul><li><em>STATISTICS IO</em><strong><em> </em></strong>provides detailed information about the impact that your query has on SQL Server.</li><li>It tells you the number of logical reads (including LOB), physical reads (including read-ahead and LOB), and how many times a table was scanned.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*-ve8NEONdPQgeXHupYtxpA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*WuCzBqKGjwa93ZzkgSCfbg.png" /></figure><p><strong><em>Indexed View:</em></strong></p><ul><li>An <strong>indexed view</strong> has a unique clustered <strong>index</strong>. The unique clustered <strong>index</strong> is stored in SQL Server and updated like any other clustered <strong>index</strong>.</li><li>An <strong>indexed view</strong> is more significant compared to standard <strong>views</strong> that involve complex processing of large numbers of rows, such as aggregating lots of data, or joining many rows.</li><li>Creating a unique <strong>clustered index</strong> on a <strong>view</strong> improves query Performance.</li></ul><p><em>/*Create view on three tables*/</em></p><p>CREATE VIEW Production_master</p><p>WITH SCHEMABINDING AS</p><p>SELECT Product_Id,Product_Name,Model_Year,List_Price,Brand_Name,</p><p>Category_Name FROM [dbo].[Products] p INNER JOIN [dbo].[Brands] b</p><p>ON b.Brand_Id = p.Brand_Id INNER JOIN [dbo].[Categories] c</p><p>ON c.Category_Id = p.Category_Id;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*UdF2eGL_WOthG6ryZ6XarQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*6NVsSlHhy9d-tOSyFgHd3A.png" /></figure><ul><li><strong><em>Create unique clustered index:</em></strong></li></ul><p>CREATE UNIQUE CLUSTERED INDEX UIDX_product_id</p><p>ON Production_master([Product_Id],[Product_Name],[Model_Year],</p><p>[List_Price],[Brand_Name],[Category_Name]);</p><ul><li><strong><em>Drop index:</em></strong></li></ul><p><strong><em>Syntax:</em></strong>DROP INDEX Index_Name on View_Name;</p><p><strong><em>Example :</em></strong>DROP INDEX UIDX_product_id ON Production_master;</p><ul><li><strong><em>Create NONclustered index:</em></strong></li></ul><p>CREATE NONCLUSTERED INDEX UIDX1_product_Name</p><p>ON Production_master(Product_Name);</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*y1Jxi0ZzcGC4jr6jJsjEiw.png" /><figcaption>Indexes</figcaption></figure><p><strong><em>If you are new to SQL refer Below video for better Understanding.</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuGlfP9o7kmY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FuGlfP9o7kmY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b108a31cf1ed747e6c45d31aa03bdf63/href">https://medium.com/media/b108a31cf1ed747e6c45d31aa03bdf63/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7860dc59a7b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQL Interview Questions]]></title>
            <link>https://medium.com/@mayuribudake999/sql-interview-questions-2cdba11e20f?source=rss-351dcd99f67e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cdba11e20f</guid>
            <category><![CDATA[sql-tutorial]]></category>
            <category><![CDATA[basic-sql]]></category>
            <category><![CDATA[learn-sql]]></category>
            <category><![CDATA[sql-queries]]></category>
            <dc:creator><![CDATA[mayuri budake]]></dc:creator>
            <pubDate>Mon, 30 Dec 2019 12:38:24 GMT</pubDate>
            <atom:updated>2019-12-30T12:38:24.707Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*DdXXCY6REvOM3mVoMj698Q.png" /><figcaption>Tables.</figcaption></figure><p><strong>Q.1. Write a SQL query to fetch the count of employees working in project ‘P1’.</strong><br>Ans. Here, we use aggregate function count() with the SQL where clause.</p><p><strong><em>Query:</em></strong>select count(*) Count_of_Project</p><p>FROM [sampleDB].[dbo].[EmployeeSalary]</p><p>where Project=’P1&#39; ;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*X2RfUpQ1_faeNWotXwl3Lg.png" /><figcaption>Fig 1</figcaption></figure><p><strong>Q.2. Write a SQL query to fetch employee names having salary greater than or equal to 5000 and less than or equal 10000.</strong><br>Ans. Here, we will use BETWEEN in the ‘where’ clause to return the empId of the employees with salary satifying the required criteria and then use it as subquery to find the fullName of the employee form EmployeeDetails table.</p><p><strong><em>Query:</em></strong></p><p>SELECT EmpFN</p><p>FROM [sampleDB].[dbo].[EmployeeDetails]</p><p>WHERE Empid IN</p><p>(SELECT Empsid FROM [sampleDB].[dbo].[EmployeeSalary]</p><p>WHERE Salary BETWEEN 5000 AND 10000);</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*rciL-CQs8HxJKuuTs-biyg.png" /><figcaption>Fig 2</figcaption></figure><p><strong>Q.3. Write a SQL query to fetch project-wise count of employees sorted by project’s count in descending order.</strong><br>Ans. The query has two requirements — first to fetch the project-wise count and then to sort the result by that count. For project wise count, we will be using GROUPBY clause and for sorting, we will use ORDER BY clause on the alias of the project-count.</p><p><strong><em>Query:</em></strong></p><p>select Project, Count(Empsid) EmpProjectCount</p><p>FROM [sampleDB].[dbo].[EmployeeSalary]</p><p>Group By Project</p><p>Order By EmpProjectCount DESC;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*Pgj9IwbQm64ICfGdi-Ar_A.png" /><figcaption>fig 3</figcaption></figure><p><strong>Q.4. Write a query to fetch only the first name(string before space) from the FullName column of EmployeeDetails table.</strong><br>Ans. In this question, we are required to first fetch the location of the space character in the FullName field and then extract the first name out of the FullName field. For finding the location we will use LOCATE method in mySQL and CHARINDEX in SQL SERVER and for fetching the string before space, we will use SUBSTRING OR MID method.</p><p><strong><em>Query:</em></strong></p><ul><li>SELECT SUBSTRING(EmpFN,0,CHARINDEX(‘ ‘,EmpFN))FirstName</li></ul><p>FROM [sampleDB].[dbo].[EmployeeDetails];</p><ul><li>SELECT LEFT(EmpFN, CHARINDEX(‘ ‘,EmpFN) — 1) FirstName</li></ul><p>FROM [sampleDB].[dbo].[EmployeeDetails];</p><p>// <strong>LEFT returns the left part of a string</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*b3o2hIJKXX9H9fUYqZ3H6Q.png" /><figcaption>fig 4</figcaption></figure><p><strong>Q.5. Write a query to fetch employee names and salary records. Return employee details even if the salary record is not present for the employee.</strong><br>Ans. Here, we can use left join with EmployeeDetail table on the left side.</p><p><strong><em>Query:</em></strong></p><p>SELECT E.EmpFN, S.Salary</p><p>FROM [sampleDB].[dbo].[EmployeeDetails]</p><p>E LEFT JOIN [sampleDB].[dbo].[EmployeeSalary] S</p><p>ON E.Empid = S.Empsid;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*PNZXHflcTYRYFmJWRXv5tA.png" /><figcaption>Fig 5</figcaption></figure><p><strong>Q.6. Write a SQL query to fetch all the Employees who are also managers from EmployeeDetails table.</strong><br>Ans. Here, we have to use Self-Join as the requirement wants us to analyze the EmployeeDetails table as two different tables, each for Employee and manager records.</p><p><strong><em>Query:</em></strong></p><p>SELECT E.EmpFN</p><p>FROM [sampleDB].[dbo].[EmployeeDetails] E</p><p>INNER JOIN [sampleDB].[dbo].[EmployeeDetails] M</p><p>ON E.EmpiD = M.ManagrID;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*1jkCE2XsgfWJfk9Gug4v2A.png" /><figcaption>Fig 6</figcaption></figure><p><strong>Q.7. Write a SQL query to fetch all employee records from EmployeeDetails table who have a salary record in EmployeeSalary table.</strong><br>Ans. Using ‘Exists’-</p><p><strong><em>Query:</em></strong></p><p>SELECT * FROM [sampleDB].[dbo].[EmployeeDetails] E</p><p>WHERE EXISTS</p><p>(SELECT * FROM [sampleDB].[dbo].[EmployeeSalary] S</p><p>WHERE E.Empid = S.Empsid);</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*n9vRj8FU_SEJChVFn9AWwQ.png" /><figcaption>Fig 7</figcaption></figure><p>//Refer Fig 5 for Understanding.</p><p><strong>Q.8. Write a SQL query to fetch duplicate records from a table.</strong><br>Ans. In order to find duplicate records from table we can use GROUP BY on all the fields and then use HAVING clause to return only those fields whose count is greater than 1 i.e. the rows having duplicate records.</p><p><strong><em>Query:</em></strong></p><p>SELECT Project, COUNT(*) CountDup</p><p>FROM [sampleDB].[dbo].[EmployeeSalary]</p><p>GROUP BY Project</p><p>HAVING COUNT(*) &gt; 1;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*ppW8udE63_0jb8xqHdqvbA.png" /><figcaption>Fig 8</figcaption></figure><p><strong>Q.9. Write a SQL query to remove duplicates from a table without using temporary table.</strong><br>Ans. Using Group By and Having clause-</p><p><strong><em>Query:</em></strong></p><p>DELETE FROM [sampleDB].[dbo].[EmployeeSalary] HERE Project IN</p><p>(SELECT Project FROM [sampleDB].[dbo].[EmployeeSalary]</p><p>GROUP BY Project HAVING COUNT(*) &gt; 1)</p><p>AND NOT Empid IN (SELECT min(Empid)</p><p>FROM [sampleDB].[dbo].[EmployeeSalary]</p><p>GROUP BY Project)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*YpSHGlWfEjHpIu8V3Dypfg.png" /><figcaption>Original Table.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*X93sL7lwLMosuH2ksM2psQ.png" /><figcaption>It Delete Two Duplicate Records 3rd and 4th.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*_wYGWNNMyxY7z0GAuqxabA.png" /><figcaption>It Delete All Duplicate Records 1st, 3rd and 4th.</figcaption></figure><p><strong>Q.10. Write a SQL query to fetch only odd and even rows from the table.</strong><br>Ans. This can be achieved by using Row_number in SQL server.</p><p><strong><em>Query:</em></strong></p><p>/* fetch ODD rows*/</p><p>SELECT E.EmpsId, E.Project, E.Salary</p><p>FROM (SELECT *, Row_Number() OVER(ORDER BY EmpsId) AS RowNumber FROM EmployeeSalary ) E</p><p>WHERE E.RowNumber % 2 = 1</p><p>/* fetch EVEN rows*/</p><p>SELECT E.EmpsId, E.Project, E.Salary</p><p>FROM (SELECT *, Row_Number() OVER(ORDER BY EmpsId) AS RowNumber FROM EmployeeSalary ) E</p><p>WHERE E.RowNumber % 2 = 0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*U3bqIMHSthpK1dN0V279ww.png" /></figure><p><strong>Q.11. Write a SQL query to create a new table with data and structure copied from another table.</strong><br>Ans. Using SELECT INTO command.</p><p><strong><em>Query:</em></strong></p><p>SELECT * INTO EmployeeData FROM EmployeeDetails</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*JiwX4-ss33WB72GdVj6aug.png" /></figure><p><strong>Q.12. Write a SQL query to create an empty table with the same structure as some other table.</strong><br>Ans. Using SELECT INTO command with False ‘WHERE’ condition.</p><p><strong><em>Query:</em></strong></p><p>SELECT * INTO EMP FROM EmployeeDetails WHERE 1 = 0;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/1*AMYhCxgSKoCy5EoNKfXszg.png" /></figure><p><strong>Q.13. Write a SQL query to find the current date-time.</strong></p><p>Ans: SQL Server-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/1*rcRPmTsQh-_hwX6FL7ppjQ.png" /></figure><p><strong>Q.14. Write a SQL query to fetch top n records?</strong><br>Ans:In SQL server using TOP command.</p><p><strong><em>Query: </em></strong>SELECT TOP(3) * FROM EmployeeSalary ORDER BY Salary DESC</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*85d5DRtKwKIVwY_TY7Dq_g.png" /></figure><p><strong><em>If you are new to SQL refer Below video for better Understanding.</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuGlfP9o7kmY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FuGlfP9o7kmY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b108a31cf1ed747e6c45d31aa03bdf63/href">https://medium.com/media/b108a31cf1ed747e6c45d31aa03bdf63/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cdba11e20f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PATINDEX FUNCTION IN SQL]]></title>
            <link>https://medium.com/@mayuribudake999/patindex-function-in-sql-5ec577bbde2?source=rss-351dcd99f67e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ec577bbde2</guid>
            <category><![CDATA[patindex-function]]></category>
            <category><![CDATA[sql-tutorial]]></category>
            <category><![CDATA[sql-functions]]></category>
            <category><![CDATA[learn-sql-server]]></category>
            <dc:creator><![CDATA[mayuri budake]]></dc:creator>
            <pubDate>Mon, 30 Dec 2019 12:26:30 GMT</pubDate>
            <atom:updated>2019-12-30T12:26:30.543Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>PATINDEX FUNCTION IN SQL</strong></p><p>· The PATINDEX() function returns the starting position of the first occurrence a pattern in a string.</p><p>· If the pattern is not found, this function returns 0.</p><p>· The search is case-insensitive and the first position in <em>string</em> is 1.</p><p>· It uses the same wildcard pattern as LIKE operator.</p><p>The Patindex function returns an int value.</p><p><strong><em>Syntax:</em></strong></p><p>PATINDEX(%pattern%, string);</p><p><strong><em>Description:</em></strong></p><p><strong>· Pattern:</strong></p><p>It is required to find pattern in String.</p><p>It Must be surrounded in %.</p><p>Also other wildcards can be used.</p><p>1) % — Match any string of any length (including 0 length)</p><p>2) _ — Match one single character</p><p>3) []- Match any characters in the brackets, e.g.[ABC]</p><p>4) [^]- Match any characters not in the brackets, e.g.[^ABC]</p><p><strong>· String:</strong></p><p>String is required for searching pattern.</p><p><strong><em>Example:</em></strong></p><p>1] Select PATINDEX(‘%come%’, ‘Welcome’) as StringPosition;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*BdqHYAvp1RoP_cJ-888GmQ.png" /></figure><p>It display 1st find character position in string according to given pattern.</p><p>2] Select PATINDEX(‘%TSQL%’, ‘Welcome To SQL’) as StringPosition;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*ZhoiHCbT-G-sW_85fJHHyg.png" /></figure><p>It displays 0 Position Because<strong> ‘T’</strong> is not present in String.</p><p>3] Select PATINDEX(‘%Lc%’, ‘Welcome To SQL’) as StringPosition;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*J1Tus1yTtQvk7dhIyfOoKQ.png" /></figure><p>It is case-insensitive. So it display 3 position.</p><p>4] Select PATINDEX(‘%c_%’, ‘Welcome To SQL’) as StringPosition;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*t0jlHOZhD2nu1AlHGy2BkQ.png" /></figure><p>SELECT PATINDEX(‘%v_ry%’, ‘Database is very Usefull’) as StringPosition;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*0CYnaj7Sj1jG0o1K-PT-WA.png" /></figure><p>_ sign display only one character position in string.</p><p>5] SELECT PATINDEX(‘D%’, ‘Database’) as StringPosition;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*Emy81kp5zdEkm3BivTKwdg.png" /></figure><p>It uses same as <strong>LIKE</strong> operator. So it Display Character position start with<strong> ‘D’.</strong></p><p>SELECT PATINDEX(‘%D’, ‘DatabaseD’) as StringPosition;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*4Zt982neo4QLSMgZopFT9w.png" /></figure><p>It Display Character position End with<strong> ‘D’.</strong></p><p><em>6] Use Patindex Function in database Query</em></p><p>SELECT CustName,</p><p>PATINDEX(‘%a%’, CustName) AS ‘Pattern Index’</p><p>FROM [sampleDB].[dbo].[CustomerTable]</p><p>WHERE PATINDEX(‘%a%’, CustName) &gt; 0;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*ZBpP2tCvAvDTyf3cc6b96A.png" /></figure><p>Here use the where clause to return only those CustName that actually match, along with their Patindex() result.</p><p><strong><em>If you are new to SQL refer Below video for better Understanding.</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuGlfP9o7kmY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FuGlfP9o7kmY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b108a31cf1ed747e6c45d31aa03bdf63/href">https://medium.com/media/b108a31cf1ed747e6c45d31aa03bdf63/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ec577bbde2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Power BI DAX Functions]]></title>
            <link>https://medium.com/@mayuribudake999/power-bi-dax-functions-1301cbef4599?source=rss-351dcd99f67e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1301cbef4599</guid>
            <category><![CDATA[calender-function]]></category>
            <category><![CDATA[power-bi-tutorials]]></category>
            <category><![CDATA[dax-function]]></category>
            <category><![CDATA[geomean-function]]></category>
            <category><![CDATA[datediff-function]]></category>
            <dc:creator><![CDATA[mayuri budake]]></dc:creator>
            <pubDate>Fri, 20 Dec 2019 11:49:49 GMT</pubDate>
            <atom:updated>2019-12-20T11:49:49.906Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>DAX:</strong></p><ul><li>DAX (Data Analysis Expressions) helps in creating new information from existing information (or) data.</li><li>DAX works on column values of a Table.</li><li>We can create calculated column and measures with DAX but we cannot calculate rows using DAX.</li></ul><p><strong><em>DAX Functions:</em></strong></p><ol><li><strong>CALENDAR</strong></li></ol><ul><li>It returns a table with a single column named “Date” that contains a contiguous set of dates.</li><li>The range of dates is from the specified start date to the specified end date, inclusive of those two dates.</li><li>An error is returned if start_date is greater than end_date.</li></ul><p><strong><em>Syntax:</em></strong></p><p>CALENDAR(&lt;start_date&gt;, &lt;end_date&gt;)</p><p><strong><em>DAX Query:</em></strong></p><p>NewCalender = CALENDAR (DATE (2018, 1, 1), DATE (2019, 12, 31))</p><p><strong><em>Example:</em></strong></p><p>First choose New Table from Modeling tab →write Query →Execute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*MjAqeUKez2faG8s6EQZVeQ.png" /><figcaption>Choose new table</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*FJv0bunO4Lx_5tupB0GK2w.png" /></figure><p><strong>2. DATEDIFF</strong></p><ul><li>It does exactly what you would expect: calculate the amount of time in between two dates, and express that value as either seconds, minutes, hours, days, weeks, months, quarters or years.</li></ul><p><strong><em>Syntax:</em></strong></p><p>DATEDIFF(TableName[Start Date], TableName[End Date], DAY)</p><p><strong><em>Query:</em></strong></p><ul><li>DayDurationColumn = DATEDIFF(Product[Start_Date], Product[End_Date], DAY)</li><li>YearDurationColumn = DATEDIFF(Product[Start_Date], Product[End_Date],YEAR)</li></ul><p><strong><em>Example:</em></strong></p><p>First choose New Column from Home tab →write Query →Execute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ry8yg1Bbry6F9cCrfWa4BA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rMxApQaMFjeai_vCxWGMAA.png" /></figure><p><strong>3. GEOMEAN</strong></p><ul><li>It returns the geometric mean of the numbers in a column.</li><li>To return the geometric mean of an expression evaluated for each row in a table.</li></ul><p><strong><em>Syntax:</em></strong></p><p>GEOMEAN( TableName[Column_Name] )</p><p><strong><em>Query:</em></strong></p><p>GeoMeanValue = GEOMEAN(Product[Internalsales])</p><p><strong><em>Example:</em></strong></p><p>First choose New Column from Home tab →write Query →Execute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AFBOHAaNoox3MbcTU77HAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*kEEyuHQvSu6zx-JFpYqpJA.png" /></figure><p><strong><em>If you are new to Power BI then must watch below video for better understanding.</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1b92aR55iaI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1b92aR55iaI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1b92aR55iaI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ddd9795e267f721a19caafeea660137/href">https://medium.com/media/5ddd9795e267f721a19caafeea660137/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1301cbef4599" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic OF Tableau Public]]></title>
            <link>https://medium.com/@mayuribudake999/basic-of-tableau-public-532b75fb7371?source=rss-351dcd99f67e------2</link>
            <guid isPermaLink="false">https://medium.com/p/532b75fb7371</guid>
            <category><![CDATA[tableau-tutorial]]></category>
            <category><![CDATA[tableau-tool]]></category>
            <category><![CDATA[tableau-public]]></category>
            <category><![CDATA[learntableau]]></category>
            <category><![CDATA[tableau-step-by-step]]></category>
            <dc:creator><![CDATA[mayuri budake]]></dc:creator>
            <pubDate>Thu, 19 Dec 2019 11:09:44 GMT</pubDate>
            <atom:updated>2019-12-19T11:09:44.130Z</atom:updated>
            <content:encoded><![CDATA[<p>Tableau:</p><ul><li>Tableau is a powerful and fastest growing data Reporting tool.</li><li>Reporting means collecting and displaying of analysed data.</li><li>Tableau public is Tableau version specially build for the cost-effective users.</li><li><strong><em>Public</em></strong> means that the workbooks created cannot be saved locally, in turn, it should be saved to the Tableau’s public cloud which can be viewed and accessed by anyone.</li><li>There is no privacy to the files saved to the cloud since anyone can download and access the same. This version is the best for the individuals who want to learn Tableau.</li><li>After download and install tableau it will like this.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*WRfy96lb41AydWxEMV7WzA.png" /><figcaption>Tableau Screen</figcaption></figure><ul><li>Tableau connect with multiple files and servers.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*Y8VcFmLGAv4rGD53Hi2-eA.png" /><figcaption>Connecting files and Servers</figcaption></figure><ul><li>We can open Saved Worksheets from Tableau Public.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*VDVq5KT7G2Cde1IeRP6Dzg.png" /><figcaption>Open Worksheets</figcaption></figure><ul><li>We can also get sample readymade data sets.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/1*2yAiRIIye9jRjNZQunKZLg.png" /><figcaption>Sample data sets</figcaption></figure><p><strong><em>Steps for Load File in Tableau.</em></strong></p><p>Click on file which you want to select → Choose file from folders</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*08xsYlWqGAN72PEqcXbBLQ.png" /></figure><p>If we add more files then click on <strong>Add</strong> and choose file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*R9uf1hOX2ucwybZCh0XNVw.png" /><figcaption>Add more files</figcaption></figure><p>Add files from <strong>New Data Source.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*QMRr-cIG5FQRRVtrKUCzZw.png" /></figure><ul><li>When we Load multiple Files in Tableau by default it create <strong>Inner join </strong>between the tables.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*Vfo-0IoLReodamins1iz7Q.png" /><figcaption>Inner Join</figcaption></figure><ul><li>Change the Type of Joins.</li></ul><p>Click On Inner join and change the type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*6EZ8l14TC-SBEObPc_76UQ.png" /><figcaption>Select Joins</figcaption></figure><ul><li>Create New Worksheet, Dashboard,Story.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*qp2jEkfy9U2-hwh4Anh2jA.png" /></figure><p><strong><em>If you are new to Tableau Must Watch below video for better understanding.</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FCWFxuTooxTY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DCWFxuTooxTY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FCWFxuTooxTY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d11143fcca4efab333d48882d7e03cb8/href">https://medium.com/media/d11143fcca4efab333d48882d7e03cb8/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=532b75fb7371" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tableau BI Tool]]></title>
            <link>https://medium.com/@mayuribudake999/tableau-bi-tool-6355fade3e85?source=rss-351dcd99f67e------2</link>
            <guid isPermaLink="false">https://medium.com/p/6355fade3e85</guid>
            <category><![CDATA[tableau-server]]></category>
            <category><![CDATA[tableau-desktop]]></category>
            <category><![CDATA[tableau-tutorial]]></category>
            <category><![CDATA[tableau-public]]></category>
            <category><![CDATA[tableau-online]]></category>
            <dc:creator><![CDATA[mayuri budake]]></dc:creator>
            <pubDate>Thu, 19 Dec 2019 07:47:04 GMT</pubDate>
            <atom:updated>2019-12-19T07:47:04.903Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Tableau:</em></strong></p><ul><li>Tableau is a powerful and fastest growing data visualization tool.</li><li>It helps in simplifying raw data into the very easily understandable format.</li><li>Data analysis is very fast with Tableau and the visualizations created are in the form of dashboards and worksheets.</li><li>The data that is created using Tableau can be understood by professional at any level in an organization. It even allows a non-technical user to create a customized dashboard.</li></ul><p><strong><em>Tableau Product Suite:</em></strong></p><ul><li>The Tableau Product Suite consists of 1) Tableau Desktop 2) Tableau Public 3) Tableau Online 4) Tableau Server and Tableau Reader.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*31zqu2pEKHJrS0y0D8HMUQ.png" /><figcaption>Tableau Products</figcaption></figure><ul><li><strong><em>1. Developer Tools:</em></strong> The Tableau tools that are used for development such as the creation of dashboards, charts, report generation, visualization fall into this category.</li><li><strong><em>2. Sharing Tools:</em></strong> The purpose of this tool is sharing the visualizations, reports, dashboards that were created using the developer tools.</li><li><strong><em>Tableau Desktop</em></strong> has a rich feature set and allows you to code and customize reports.It is Costly tool.</li><li>In <strong><em>Tableau public</em></strong>, workbooks created cannot be saved locally, in turn, it should be saved to the Tableau’s public cloud which can be viewed and accessed by anyone. It is free tool.</li><li><strong><em>Tableau server</em></strong> is specifically used to share the workbooks, visualizations that are created in the Tableau Desktop application across the organization.</li><li><strong><em>Tableau online</em></strong> has all the similar functionalities of the Tableau Server, but the data is stored on servers hosted in the cloud which are maintained by the Tableau group.</li><li><strong><em>Tableau Reader </em></strong>is a free tool which allows you to view the workbooks and visualizations created using Tableau Desktop or Tableau Public.</li><li>Tableau connects and extracts the data stored in various places. It can pull data from any platform.</li></ul><p><strong><em>Usage of Tableau:</em></strong></p><ul><li>Tableau software is used to translate queries into visualization.</li><li>It is also used for managing metadata.</li><li>Tableau software imports data of all sizes and ranges.</li></ul><p><strong><em>Features of Tableau:</em></strong></p><ol><li><strong>Real</strong>-<strong>Time Analysis: </strong>It will enable users to quickly analyze and understand dynamic data, especially when the Velocity is high, <strong>real</strong>-<strong>time analysis</strong> is very critical.</li></ol><p><strong>2. Data Blending</strong> : It is used when there is related data in multiple data sources, which you want to analyze together in a single view.</p><p><strong>3. Collaboration of data</strong> : Team members are able to share <strong>data</strong>, make follow up queries, and forward easy-to-digest visualizations to others who could gain value from the data.</p><p><strong><em>If you are new to Tableau Must Watch below video for better understanding.</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FCWFxuTooxTY%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DCWFxuTooxTY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FCWFxuTooxTY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b98b5276305fb83289f6ee07e7b4b461/href">https://medium.com/media/b98b5276305fb83289f6ee07e7b4b461/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6355fade3e85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Temp Table, Table Variable And CTE In SQL Server]]></title>
            <link>https://medium.com/@mayuribudake999/temp-table-table-variable-and-cte-in-sql-server-a140351d4dab?source=rss-351dcd99f67e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a140351d4dab</guid>
            <category><![CDATA[table-variable]]></category>
            <category><![CDATA[learn-sql-step-by-step]]></category>
            <category><![CDATA[sql-tutorial]]></category>
            <category><![CDATA[cte-in-sql-server]]></category>
            <category><![CDATA[temp-table]]></category>
            <dc:creator><![CDATA[mayuri budake]]></dc:creator>
            <pubDate>Wed, 18 Dec 2019 11:48:12 GMT</pubDate>
            <atom:updated>2019-12-18T11:48:12.486Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Temp Table:</em></strong></p><ul><li>Temp tables are also called as <strong>hash tables</strong> or <strong>temporary tables</strong>.</li><li>The temporary tables are created during the execution time.</li><li>The temp tables are available only in the scope where they are created.</li><li>They are stored in the <strong>tempdb </strong>and will get dropped automatically after the scope.</li><li>The name of the temp tables can have a maximum of 116 characters.</li><li>The structure of temp table can be altered after creating.</li><li>We can explicitly drop temp tables using DROP statement.</li><li>It cannot be used in User Defined Function (UDF).</li><li>Temp tables take part in transactions.</li><li>We can be created Index on temp tables.</li><li>We can apply read lock on temp tables.</li><li>Constraints can be created on temp tables except FOREIGN KEY.</li><li>Temp table is maintaining a require statistics.</li><li>Temporary tables are of two types, <strong>Local Temp Tables</strong> and <strong>Global Temp Tables</strong>.</li></ul><ol><li>The <strong><em>local temp table</em></strong> is available only in the current session.</li></ol><p><strong><em>Only one </em></strong>SQL Server user can use the temp table.</p><p>Once the stored procedure finishes execution, the temp table drops automatically from the tempdb.</p><p>2. The<strong><em> global temp tables</em></strong> are available for all the sessions or the SQL Server connections.</p><p><strong><em>Multiple </em></strong>SQL Server users can use the same temp table.</p><p><strong>Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/185/1*pGwlqO4rFEOcuA78gHaEVA.png" /><figcaption>tempdb database.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*AI3aDXeyD2S1yvStFoLfEQ.png" /><figcaption>Local temp table.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*HCviOeqFeifvD09gM5_Yvg.png" /><figcaption>Global temp table.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*GgOJuJSFqfx-lCK5GL22-g.png" /><figcaption>Explicitly Drop table.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*1TKLuKzlNtpaCzk_qB176g.png" /><figcaption>Using primary Constraint.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*4oRNcOXvQinpRNTm4-OeBQ.png" /><figcaption>Create stored procedure on temp table and maintaining Statistics Information.</figcaption></figure><p><strong><em>Table Variable:</em></strong></p><ul><li>Temp Variables used for holding the data for a temporary time just like Temp tables.</li><li>Temp variables are created using “DECLARE” statements and are assigned values by using either a SET or SELECT command.</li><li>This acts like a variable and exists for a particular batch of query executions. It gets dropped once it comes out of batch.</li><li>Temp variables are also created in the tempdb database but not the memory.</li><li>It is used when you are required to use the current result set in next queries then store result into temp variables.</li></ul><p><strong>Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*M63RpevhMvqd3NBZfWcejA.png" /><figcaption>Temp variable.</figcaption></figure><p><strong><em>Common Table Expression(CTE):</em></strong></p><ul><li>CTE work as a temporary result set generated from SELECT query defined by WITH clause.</li><li>CTE is the result of complex sub queries.</li><li>Similar to temporary tables CTE doesn’t store as an object,the scope is limited to the current query.</li><li>CTE improves readability and ease in maintenance of complex queries and sub-queries.</li><li>There are two types of Common Table Expression <strong><em>Non-Recursive CTE</em></strong> and <strong><em>Recursive CTE.</em></strong></li></ul><ol><li>Non-recursive common table expression is the generic form of CTE. It does not have any reference to itself in the CTE definition.</li><li>Recursive CTE has reference to itself.</li></ol><p><strong>Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*UfGSyO1GEAVJIFKE_KkrGw.png" /><figcaption>Tables for CTE.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*OW4nJd-f1TaQ2yZBW8rAMw.png" /><figcaption>CTE Example.</figcaption></figure><p><strong><em>If you are new to SQL refer Below video for better Understanding.</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuGlfP9o7kmY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FuGlfP9o7kmY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b108a31cf1ed747e6c45d31aa03bdf63/href">https://medium.com/media/b108a31cf1ed747e6c45d31aa03bdf63/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a140351d4dab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SLICER IN POWER BI]]></title>
            <link>https://medium.com/@mayuribudake999/slicer-in-power-bi-e9461d287ea0?source=rss-351dcd99f67e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9461d287ea0</guid>
            <category><![CDATA[power-bi-tutorials]]></category>
            <category><![CDATA[slicer]]></category>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[numeric-slicer]]></category>
            <category><![CDATA[date-slicer]]></category>
            <dc:creator><![CDATA[mayuri budake]]></dc:creator>
            <pubDate>Mon, 16 Dec 2019 09:34:26 GMT</pubDate>
            <atom:updated>2019-12-16T09:34:26.504Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Slicer</em></strong>:</p><ul><li>Slicers in Power BI are a type of visual filters.</li><li>Slicers enable a user to sort and filter a packed report and view only the information they want.</li><li>Unlike filters, the slicers are present as a visual on the report and let a user select values as they are analyzing the report.</li></ul><p><strong><em>Use of slicer:</em></strong></p><ul><li>To easily access important and frequently used filters by putting them on the report canvas.</li><li>View a focused report by placing the slicer right next to essential graphs and charts.</li><li>Easily view all the currently applied filters on the report instead of going to the filters drop-down list.</li></ul><p><strong><em>Steps for Create Slicer:</em></strong></p><ol><li>Open Power BI Desktop. Start creating a new report on the empty canvas.</li></ol><p>From the Visualizations pane, select Slicer icon. This will bring an empty template of a Slicer on the editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*whl3F8hxs5n4dh3Hh_35ag.png" /><figcaption>Choose slicer.</figcaption></figure><p>2. Drag and drop a field from the Fields section to Values column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*MWbQWMoU2LAvE9dH1IhuSQ.png" /><figcaption>Add value</figcaption></figure><p>We have added the field Accounting Report Name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*pxGlFxrEj8otMAQdODLk_w.png" /></figure><p>3.In the format tab, you get a lot of formatting options such as <em>Selection controls, Slicer header, Items, Title, Background, Border,</em> etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/186/1*3335Yg7SeHdfr-3N_5G_ag.png" /><figcaption>Formatting Options.</figcaption></figure><p>From the Selection controls tab, you can select the type of item selection. There are three types in which you can select the slicer items; <em>single select, multi-select</em> and<em> select all</em> option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*NhacbR7eN_E4cWPZNeyciA.png" /><figcaption>Selection Control.</figcaption></figure><p><strong><em>Date Slicer:</em></strong></p><ul><li>A date slicer is made when you add a date field as the slicer value.</li><li>The date slicer will have a sliding bar with two buttons at each end.</li><li>You can slide these buttons forward or backward to adjust your range. By default, the range will be set from the oldest to the newest date.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*mrMRynoxcfOrKKJSaLTOOg.png" /><figcaption>Date slicer.</figcaption></figure><ul><li>By clicking on a date, you can get a calendar view of the date.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*S3WT7pcSWIJUdMH_rydIpg.png" /><figcaption>Calendar view.</figcaption></figure><ul><li>You can change the type of date slicer from the drop-down menu. You can select from the options such as <em>Between, Before, After, List, Dropdown and Relative</em>. The type of your date slicer will depend on your purpose of use.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*MS9MRi9qtIydWXPdiTMJug.png" /><figcaption>Type of slicer.</figcaption></figure><p><strong><em>Numeric Range Slicer:</em></strong></p><ul><li>It is like the date slicer, when you use a numeric field to create a slicer, a numeric range slicer is created.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*JIA7KNVEahSXaqJ9R3FWhw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*vX_2W1Pn1zI6r-gqECCNJg.png" /><figcaption>Select type of slicer.</figcaption></figure><ul><li>We create different visualizations.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*5ehrjAZMtQlrJcxCbRF2uw.png" /><figcaption>Multiple visuals.</figcaption></figure><ul><li>When we change in Numeric Slicer the values in Pie chart are changed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*QVd7FH8GDQPVYx1mdCv3tw.png" /></figure><p><strong><em>Limitations of Power BI Slicer :</em></strong></p><ul><li>No support for input fields in Power BI slicers.</li><li>You cannot pin a slicer to a dashboard.</li><li>Slicers do not support drill down in Power BI report.</li><li>No support for visual level filters in Power BI slicers.</li></ul><p><strong><em>If you are new to Power BI then must watch below video for better understanding.</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1b92aR55iaI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1b92aR55iaI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1b92aR55iaI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ddd9795e267f721a19caafeea660137/href">https://medium.com/media/5ddd9795e267f721a19caafeea660137/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9461d287ea0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Column Store Index]]></title>
            <link>https://medium.com/@mayuribudake999/column-store-index-894095dba27?source=rss-351dcd99f67e------2</link>
            <guid isPermaLink="false">https://medium.com/p/894095dba27</guid>
            <category><![CDATA[sql-columnstore-index]]></category>
            <category><![CDATA[sql-tutorial]]></category>
            <category><![CDATA[learn-sql-step-by-step]]></category>
            <category><![CDATA[columnstore-index]]></category>
            <category><![CDATA[sql-index]]></category>
            <dc:creator><![CDATA[mayuri budake]]></dc:creator>
            <pubDate>Thu, 12 Dec 2019 09:06:41 GMT</pubDate>
            <atom:updated>2019-12-12T09:06:41.233Z</atom:updated>
            <content:encoded><![CDATA[<ul><li>A columnstore index is a technology for storing, retrieving, and managing data by using a columnar data format .</li><li>A columnstore is data that’s logically organized as a table with rows and columns, and physically stored in a column-wise data format.</li><li>In Clustered index data store in rowstore format.</li><li>A rowstore is data that’s logically organized as a table with rows and columns, and physically stored in a row-wise data format.</li><li>Columnstore index is a column-based non-clustered index.</li><li>Columnstore index arrange data in column wise per page.In columnstore index one column fit as one 8KB page.</li><li>It <strong>reduce </strong>Estimated I/O cost and use memory more efficiently.</li><li>It increases performance of Select query. Because it fetch column data, based on structure of columnstore index.</li><li>It apply compression. By applying compression we store multiple rows in one page.</li></ul><p>E.g.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/1*1YelzJRVH0RIRUBAr4C_AQ.png" /></figure><p>Suppose, we have same records like India, USA then columnstore index create Numbering on that records using this we can store multiple data in one page.</p><ul><li>For OLAP system where customer have fetches the records, Analysis the records columnstore indexes is useful.</li><li>Columnstore index useful for projects like SSAS, SSIS.</li><li>If you’re data is highly transactional then columnstore index is not good e.g OLTP.</li></ul><p><strong><em>Syntax:</em></strong></p><p>Create Nonclustered Columnstore Index Index_Name</p><p>on Table_Name(Column_Names);</p><p><strong><em>Example:</em></strong></p><p>Create Nonclustered Columnstore Index MycolumnStore</p><p>on Employee(Employee_id,Employee_Name);</p><p><strong><em>We compare clustered index and Columnstore index for see the Better performance and Estimate I/O Cost.</em></strong></p><ul><li>Now On Employee table clustered index is present.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*f6bz4k0IOTagABCbh3c_GA.png" /><figcaption>Right click on Primary key and choose indexes/Keys.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*UiLmO29k1GaVN2enBStFDA.png" /><figcaption>Clustered Index.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*2ZgCsTl9uJmBMY6FCj4IHA.png" /><figcaption>Icon for see Execution plan.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*rbNu1ol8uCiSN-hZFDJGAw.png" /><figcaption>Query plan</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*ocyA5kOAd_X25xZJwEy5Aw.png" /><figcaption>plan size</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*TzmJS10gFgnbaIvY2Svvqw.png" /><figcaption>Select rows.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*NUNk4BiewYKcPDKGviysBQ.png" /><figcaption>Clustered index performance.</figcaption></figure><ul><li>Now we create columnstore index on Employee table.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I4BXHMwz8_rd1ojYECooag.png" /><figcaption>Columnstore index.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*Ip-NnIqwjDV4LlDD1eAmEg.png" /><figcaption>Columnstore index performance.</figcaption></figure><p><strong><em>If you are new to SQL refer Below video for better Understanding.</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuGlfP9o7kmY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FuGlfP9o7kmY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b108a31cf1ed747e6c45d31aa03bdf63/href">https://medium.com/media/b108a31cf1ed747e6c45d31aa03bdf63/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=894095dba27" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>