<?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 Smita Gudale on Medium]]></title>
        <description><![CDATA[Stories by Smita Gudale on Medium]]></description>
        <link>https://medium.com/@smitagudale712?source=rss-38562e09cd63------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*CJ3EXRR6BjYt4HntSKSWJQ.jpeg</url>
            <title>Stories by Smita Gudale on Medium</title>
            <link>https://medium.com/@smitagudale712?source=rss-38562e09cd63------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 00:42:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@smitagudale712/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[“SQL INTERVIEW: Questions  & Answers”]]></title>
            <link>https://medium.com/@smitagudale712/sql-interview-questions-answers-cdbc226fdedb?source=rss-38562e09cd63------2</link>
            <guid isPermaLink="false">https://medium.com/p/cdbc226fdedb</guid>
            <category><![CDATA[sql-server-tutorial]]></category>
            <category><![CDATA[sql-answers]]></category>
            <category><![CDATA[sql-questions]]></category>
            <category><![CDATA[imp-q-a]]></category>
            <category><![CDATA[learn-sql-server]]></category>
            <dc:creator><![CDATA[Smita Gudale]]></dc:creator>
            <pubDate>Mon, 03 Feb 2020 10:56:09 GMT</pubDate>
            <atom:updated>2020-02-03T11:59:22.118Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>“SQL INTERVIEW: Questions &amp; Answers”</strong></h3><p><strong>1.</strong> <strong>What is a Database?</strong></p><p>The database is an electronic system. It is an organized collection of data so data can be easily managed, accessed and manipulated. Most of the database contains tables, which may each include several different fields.</p><p><strong>2.</strong> <strong>What is DBMS?</strong></p><p>DBMS is a Database Management System. It is system software that enables the user to create their own databases as per their requirements.</p><p><strong><em>Examples of DBMS - </em></strong>MySQL, Microsoft Access, Oracle, PostgreSQL, dBase, FoxPro, SQLite, Microsoft SQL Server, etc.</p><p><strong>3.</strong> <strong>What is RDBMS?</strong></p><p>RDBMS is a Relational Database Management System. In this relationship between the tables. It is an advanced version of DBMS.</p><p><strong>4. Difference between DBMS and RDBMS?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*jp_UUk9N2UWYOuzlKxLpPg.png" /></figure><p><strong>5. What is SQL?</strong></p><p>SQL is a Standard Query Language. It is pronounced as SQL or sometimes See-Quel. SQL is a standard language for accessing and manipulating the database.</p><p><strong>6.</strong> <strong>Difference between SQL and MYSQL?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*KgnJIDxqkbSlaNBGwOM-rQ.png" /></figure><p><strong>7.</strong> <strong>Difference between Char and NChar?</strong></p><p><strong>Char -</strong></p><ul><li>It is a fixed-length data type</li><li>Char store Non-Unicode characters i.e. ASCII.</li><li>ASCII represents the lower case, uppercase, digit, and symbols.</li><li>Occupy 1 byte of space for each character.</li><li>The maximum length of 8,000 characters.</li></ul><p><strong>Nchar –</strong></p><ul><li>It is a fixed-length data type.</li><li>NChar stores Unicode characters.</li><li>Unicode represents letters in English, Greek, etc.</li><li>Occupy 2 bytes of space for each character.</li><li>The maximum length of 4000 characters.</li></ul><p><strong>8.</strong> <strong>Difference between Varchar and NVarchar?</strong></p><p><strong>Varchar –</strong></p><ul><li>It is a variable-length data type.</li><li>Varchar stores Non-Unicode characters i.e. ASCII.</li><li>ASCII represents the lower case, uppercase, digit, and symbols.</li><li>Occupy 1 byte of space for each character.</li><li>The maximum length of 8,000 characters.</li></ul><p><strong>NVarchar –</strong></p><ul><li>It is a variable-length data type.</li><li>NVarchar stores Unicode characters.</li><li>Unicode represents letters in English, Greek, etc.</li><li>Occupy 2 bytes of space for each character.</li><li>The maximum length of 4000 characters.</li></ul><p><strong>9.</strong> <strong>What is Group BY in SQL?</strong></p><p>The GROUP BY statement groups rows that have the same values into summary rows.</p><p>The GROUP BY statement is used with aggregate functions like COUNT, MAX, MIN, SUM, AVG to group the result-set by one or more columns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*LUh6Ebs-quC7jXwhmhnrAw.png" /><figcaption><strong>SYNTAX</strong></figcaption></figure><p><strong>10. What is Order By in SQL?</strong></p><p>The ORDER BY keyword is used to sort the result in ascending or descending order. It sorts the results by default in ascending order. To sort the records in descending order, use the DESC keyword.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*0pvynQgt9vaZQABLZTnAzw.png" /><figcaption><strong>SYNTAX</strong></figcaption></figure><p><strong>11. Difference between Having and Where Clause.</strong></p><p>WHERE and HAVING both are used with the GROUP BY clause.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*lFsPmSZwPFjijZjf42TtRA.png" /></figure><p><strong>12.</strong> <strong>What are the TCL commands in SQL?</strong></p><p>TCL is a Transaction Control Language. These are used for the manage transactions in the database also these manage any changes in data made by DML statements.</p><p>COMMIT, ROLLBACK and SAVEPOINT are the TCL commands used in SQL.</p><ul><li><strong>COMMIT </strong>command is used to<strong> </strong>permanently save any transaction into the database.</li><li><strong>ROLLBACK </strong>command restores the database to last committed state. ROLLBACK also used with the save point.</li><li><strong>SAVEPOINT </strong>command is used to temporarily save a transaction so that you can roll back to that point whenever required.</li></ul><p><strong>13.</strong> <strong>What are the Aggregate functions in SQL?</strong></p><p><strong>AVG</strong> — calculates the average of a set of values.</p><p><strong>COUNT</strong> — counts rows in a specified table or view.</p><p><strong>MIN</strong> — gets the minimum value in a set of values.</p><p><strong>MAX</strong> — gets the maximum value in a set of values.</p><p><strong>SUM</strong> — calculates the sum of values.</p><p><strong>14. What is the primary key?</strong></p><p>A primary key uniquely identifies the values in the table. It does not repeat the values. In Primary key NULL values are not allowed.</p><p>Without the Primary key, we cannot create a relationship in two tables.</p><p>The foreign key of one table should be a Primary key of another table. We can give the primary keys only one time in a table.</p><p><strong>Example- </strong>Suppose in a table<strong> Id</strong> is a column name. we set this as primary key once then it does not change.</p><p><strong>15.</strong> <strong>What is a unique key?</strong></p><p>The unique key has the candidate key. The unique key accepts the NULL values. We can give multiple unique keys in a table.</p><p><strong>Example- </strong>Aadhar Number, Mobile Number</p><p>Some people did not have an Aadhar number then it can be null.</p><p>In mobile number in India +91 add automatically to our number then it changes so unique key can be changed.</p><p><strong>16. What is the foreign key?</strong></p><p>The foreign key of one table should be a primary key of another table.</p><p>A foreign key is a column that references a column (most often the primary key) of another table.</p><p>The purpose of the foreign key is to ensure referential integrity of the data.</p><p><strong>17.</strong> <strong>What is a join? What are the types of joining and explain each?</strong></p><p>A SQL Join statement is used to combine data or rows from two or more tables based on a common field between them. Types of Joins as follows –</p><p><strong><em>INNER JOIN -</em></strong></p><p>Inner Join selects the records that have matching values in both table<em>s.</em></p><p><strong><em>LEFT JOIN -</em></strong></p><p>Left Join selects all records from the left side table and only matching records from the right-side table.</p><p><strong><em>RIGHT JOIN -</em></strong></p><p>Right Join select all records from the Right-side table and only matching records from the left side table.</p><p><strong><em>FULL OUTER JOIN -</em></strong></p><p>Full Outer Join selects all records that match either left or right table records.</p><p><strong>18.</strong> <strong>Difference between Union and Union All?</strong></p><p>Union combines the two or more tables and display only the unique records from the tables.</p><p>Union All combines the two or more tables and displays all records including duplicate records.</p><p>Union All is faster than the Union because the Union uses the Distinct.</p><p><strong>19. What is Normalization?</strong></p><p>Normalization is a process of organizing data in the database. It removes the data redundancy and Ensures the data dependencies are proper.</p><p>Normalization forms are divided into 4 normal forms as follows –</p><ul><li>First Normal Form (1 NF).</li><li>Second Normal Form (2 NF).</li><li>Third Normal Form (3 NF).</li><li>Boyce and Codd Normal Form (BCNF).</li></ul><p><strong>20.</strong> <strong>What are all the different types of Normalizations?</strong></p><p><strong>1NF - </strong>The first normal form contains only atomic values and It is held an only single value.</p><p><strong>2NF - </strong>The table is a must in the First normal form. All columns are depending on the table&#39;s primary keys and create a relationship between new tables.</p><p><strong>3NF - </strong>The table must in the second normal form. All of its columns are not transitively dependent on the primary key.</p><p><strong>BCNF - </strong>The table must in the third normal form. In BCNF if every functional dependency X → Y, X is the super key of the table. BCNF is an advance version of the third normal form.</p><p><strong>21.</strong> <strong>What is Denormalization?</strong></p><p>Denormalization is a database optimization technique. It is applied after doing normalization.</p><p>In which we add redundant data to one or more tables. This can help us avoid costly joins in a relational database.</p><p><strong>22. Normalization vs Denormalization</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*o-2ztfHtw9Y29WbnyGMFxQ.png" /></figure><p><strong>23.</strong> <strong>What is a View?</strong></p><p>View store the data in the virtual tables data is not stored permanently. Views display only selected data. It is used for security purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*Hja7aWoiPJSUaff-JWoqng.png" /><figcaption><strong>SYNTAX</strong></figcaption></figure><p><strong>24. What are indexes and why it makes our search faster?</strong></p><p>Indexes are used to retrieve data from the database very fast. It uses for the Fast search.</p><p>Indexes use B Tree that makes searching fast. B tree patriciates the data into two or more parts and search the result.</p><p>The index is a data structure that is used to quickly locate and access the data in a database table.</p><p>The disadvantage is they decrease performance on inserts, updates, and deletes.</p><p><strong>25. What are the types of Indexes?</strong></p><p>Types of indexes are Clustered Index and Non-Clustered Index.</p><p><strong>Clustered Index -</strong></p><p>In clustered index Leaf node have actual data (data is present in leaf node). Only one clustered index will create.</p><p><strong>Non-clustered Index -</strong></p><p>In non-clustered index leaf nodes not contain any data. The non-clustered index uses a leaf node of the clustered index for searching data. We can create multiple non-clustered indexes.</p><p><strong>26.</strong> <strong>What is the difference between the Clustered and Non-Clustered Index?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*_6BDWKNsgkWCIvZQ2TCE3A.png" /></figure><p><strong>27.</strong> <strong>What are the Different Types of Relationships in SQL?</strong></p><p><strong>One-to-one </strong>- One-to-One (1–1) relationship is defined as the relationship between two tables where both the tables should be associated with each other based on only one matching row.</p><p>This relationship can be created using Primary Key-Unique foreign key constraints.</p><p><strong>One-to-many - </strong>The primary key table contains only one record that relates to none, one, or many records in the related table</p><p><strong>Many-to-many - </strong>This relation is used<strong> </strong>when the rows in the first table can map to multiple rows in the second table and those rows in the second table can also map to multiple rows in the first table.</p><p><strong>28.</strong> <strong>What is a Query?</strong></p><p>A query is a request for data or information from a database table or combination of tables.</p><p>This data may be generated as results returned by Structured Query Language (SQL) or as pictorials, graphs or complex results.</p><p><strong>29. What is a Subquery?</strong></p><p>A Subquery is a query under query. It is also called an Inner query or a Nested query. The subquery is embedded within the WHERE clause. Subquery nested inside an INSERT, DELETE, UPDATE or SELECT statements.</p><p><strong>30.</strong> <strong>What are the types of subquery?</strong></p><ul><li>Single-row subquery — It returns zero or one row.</li><li>Multiple row subquery — It returns one or more rows.</li><li>Multiple column subqueries — It returns one or more columns.</li><li>Correlated subqueries — Reference one or more columns in the outer SQL statement.</li></ul><p><strong>31. What is a Correlated query?</strong></p><p>The correlated query is a subquery (a query nested inside another query) that uses values from the outer query.</p><p><strong>32.</strong> <strong>What is a stored procedure? Why it is used?</strong></p><p>Stored Procedure is written code once and reuse again and again. It returns the 0 or Multiple values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/258/1*Z6e4YmrerUEF6I8l5iOlTQ.png" /><figcaption><strong>SYNTAX</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/1*PKG1sYWotvXZfkn_0gHXuQ.png" /><figcaption><strong>Execute stored Procedure</strong></figcaption></figure><p>Stored procedures provide improved performance because fewer calls need to be sent to the database.</p><p>For example, if a stored procedure has four SQL statements in the code, then there only needs to be a single call to the database instead of four calls for each individual SQL statement.</p><p><strong>33.</strong> <strong>Explain the types of parameters in Stored Procedure?</strong></p><p>Input parameters allow the caller to pass a data value to the stored procedure or function.</p><p>Output parameters allow the stored procedure to pass a data value or a cursor variable back to the caller. Every stored procedure returns an integer return code to the caller.</p><p><strong>34.</strong> <strong>What is the Recursive Stored Procedure?</strong></p><p>Recursive stored procedure refers to a stored procedure that calls by itself until it reaches some boundary condition.</p><p>This recursive function or procedure helps the programmers to use the same set of code N number of times.</p><p><strong>35.</strong> <strong>Advantages and Disadvantages of Stored Procedure?</strong></p><p><strong>Advantages –</strong></p><ul><li>One-time, One-place Processing.</li><li>Create a one-time store and call several times it reuses the Code.</li><li>Testing Can be tested independently of the application.</li></ul><p><strong>Disadvantage</strong> –</p><ul><li>It can make debugging more complex.</li><li>It can also be sensitive to being dropped during copy operations, if not done correctly.</li></ul><p><strong>36.</strong> <strong>What are the Functions?</strong></p><p>The function is the same as the Stored Procedure. It reuses the code but it returns an only scalar value.</p><p>We can write the functions inside the stored procedures but we cannot write the stored procedure inside the function.</p><p>It accepts only input parameters, performs the actions and produces the results.</p><p><strong>37.</strong> <strong>What is a trigger? Types of a trigger?</strong></p><p>A trigger is a special type of stored procedure that automatically invokes when an event occurs in the database server. An event like INSERT, DELETE, UPDATE.</p><p><strong>Types of Trigger –</strong></p><ul><li><strong>AFTER Triggers - </strong>AFTER Triggers are executed after the DML statement completes but before it is committed to the database.</li><li><strong>INSTEAD OF Triggers -</strong> INSTEAD OF Triggers are the triggers that get executed automatically when the records are inserting, deleting or updating.</li></ul><p><strong>38.</strong> <strong>What are the local and global variables?</strong></p><p><strong>Global variables</strong> are declared outside any function. They can be used on any function in the program.</p><p><strong>Local variables</strong> are declared inside a function. They can be used only inside that function. It is possible to have local variables with the same name in different functions.</p><p><strong>39.</strong> <strong>Which is the constraint in SQL?</strong></p><ul><li>NOT NULL — It ensures the column cannot have a NULL value.</li><li>UNIQUE — It ensures that all values in a column are different.</li><li>PRIMARY KEY — A combination of a NOT NULL and UNIQUE.</li><li>FOREIGN KEY — Uniquely identifies a row in another table.</li></ul><p><strong>40. What is Data Integrity?</strong></p><p>Data integrity is the overall completeness, accuracy, and consistency of data. It is good data and trust in data.</p><p><strong>41.</strong> <strong>What is Referential Integrity?</strong></p><p>In referential Integrity, it states that table relationships must always be consistent. In this One tables Foreign key references the Primary key of another table.</p><p><strong>42.</strong> <strong>What is Auto Increment?</strong></p><p>Auto-increment allows a unique number to be generated automatically when a new record is inserted into a table. Auto Increment Field is a Primary Key Field.</p><p><strong>43.</strong> <strong>What are Tables and Fields?</strong></p><p><strong>TABLE </strong>- A table is a collection of related data held in a table format within a database. It consists of columns and rows.</p><p><strong>FIELDS – </strong>The field is a single piece of data. Fields are organized into records, which contain all the information within the table relevant to a specific entity.</p><p><strong>44.</strong> <strong>What is Deadlock? and how we can prevent it?</strong></p><p>A deadlock is an unwanted situation in which two or more transactions are waiting indefinitely for one another to give up locks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/182/1*r3Y3VJ5l6G6Sd0jsMlg5sg.png" /></figure><p>A deadlock can be prevented if the resources are allocated in such a way that deadlock never occurs. Following conditions are used for the prevent the deadlock –</p><p><strong>Mutual Exclusion - </strong>If at least one or more resource is in non-shareable mode.</p><p><strong>Hold and Wait - </strong>Processes which are already holding at least 1 resource may request new resource.</p><p><strong>No pre-emption - </strong>Resources can’t be released by force. Only the process holding the resource can release it, which does so after the process has finished its task.</p><p><strong>Circular wait - </strong>Two or more process form a circular chain where each process waits</p><p><strong>45.</strong> <strong>What is Datawarehouse?</strong></p><p>Datawarehouse stores a huge amount of data. A data warehousing is defined as a technique for collecting and managing data from varied sources to provide meaningful business insights.</p><p><strong>46. How we can generate an empty table from an existing table</strong></p><p>By generating Script, we can create an empty table from an existing table, Steps –</p><ul><li>Right-click on the table</li><li>Click on script table as</li><li>Create to</li><li>The new query editor window</li></ul><p><strong>47. What is Self-Join?</strong></p><p>A self-join is a join in which a table is joined with itself (which is also called Unary relationships).</p><p>Especially when the table has a FOREIGN KEY which references its own PRIMARY KEY.</p><p>To join a table itself means that each row of the table is combined with itself and with every other row of the table.</p><p><strong>48.</strong> <strong>What is Cross-Join?</strong></p><p>The SQL CROSS JOIN produces a result set which is the number of rows in the first table multiplied by the number of rows in the second table.</p><p>If the WHERE clause is not used along with CROSS JOIN, this kind of result is called a Cartesian Product. EXAMPLE –</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/204/1*3pY1QuXRO6VMifXIWF3Xxw.png" /></figure><p><strong>49. What are the differences between OLTP and OLAP?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*e3Ge_gRrAcmkdbsIPsgn9Q.png" /></figure><p><strong>50.</strong> <strong>What is the Cursor?</strong></p><p>A cursor is a temporary work area created in the system memory when a SQL statement is executed.</p><p>A cursor contains information on a select statement and the rows of data accessed by it.</p><p>This temporary work area is used to store the data retrieved from the database, and manipulate this data.</p><p><strong>51.</strong> <strong>What are the Types of Cursor?</strong></p><p><strong>Implicit Cursor - </strong>It is automatically declared by Oracle whenever a SQL statement is executed. It is used to process the instructions INSERT, UPDATE, DELETE, and SELECT. During the processing of an implicit cursor, Oracle automatically performs operations OPEN, FETCH, and CLOSE.</p><p><strong>Explicit Cursor </strong>– An explicit cursor is used for queries that return more than one registration. It is declared and called by the programmer.</p><p><strong>52.</strong> <strong>What is the SQL Server Agent?</strong></p><p>SQL server agent is a software that is provided by the SQL server. Which helps to run any SQL job as a background process.</p><p>Steps for the SQL Server Agent Run as follows -</p><ul><li>Right-click on SQL Agent</li><li>Click on Start</li><li>Create a new job</li><li>Then add schedule means when u run exactly for e.g. 5 min etc.</li><li>Finally, Run the job.</li></ul><p><strong>53. Difference between the DROP, DELETE and TRUNCATE?</strong></p><p><strong>DROP – </strong>DROP is a DDL command. It removes a table from the database. It can’t rollback. No triggers are fired.</p><p><strong>Syntax - </strong>DROP TABLE table-name</p><p><strong>DELETE – </strong>DELETE is a DML command. We use the WHERE clause with it. It removes rows from the table. It can be rolled back. Its performance is slower. The trigger is fired.</p><p><strong>Syntax – </strong>DELETE FROM table-name WHERE condition</p><p><strong>TRUNCATE - </strong>TRUNCATE is a DDL command. We can’t use WHERE clause with it. It removes all the rows from a table. It cannot be rolled back. Performance is faster. No trigger is fired.</p><p><strong>Syntax - </strong>TRUNCATE TABLE table-name</p><p><strong>54.</strong> <strong>What are String Functions in SQL?</strong></p><ul><li>CHARINDEX<strong> — </strong>Returns the position of a substring in a string</li><li>LOWER — Converts a string to lower-case</li><li>LTRIM<strong> — </strong>Removes leading spaces from a string</li><li>REPLACE<strong> — </strong>Replaces all occurrences of a substring within a string, with a new substring</li><li>REVERSE<strong> — </strong>Reverses a string and returns the result</li><li>RTRIM<strong> — </strong>Removes trailing spaces from a string</li><li>STR<strong> — </strong>Returns a number as a string</li><li>STUFF<strong> — </strong>Deletes a part of a string and then inserts another part into the string, starting at a specified position</li><li>SUBSTRING<strong> — </strong>Extracts some characters from a string</li><li>TRIM<strong> — </strong>removes leading and trailing spaces (or other specified characters) from a string</li><li>UPPER<strong> — </strong>Converts a string to upper-case</li></ul><p><strong>55.</strong> <strong>What is the SQL CASE statement?</strong></p><p>The CASE statement executes through the conditions and returns a value when the first condition is met.</p><p>The CASE statement is executed like an IF-THEN-ELSE statement. So, once a condition is true, it will stop reading and return the result.</p><p>If no conditions are true, it returns the value in the ELSE clause.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*ON1ouJWbNVhQJTqxaNbz-w.png" /><figcaption><strong>SYNTAX</strong></figcaption></figure><p><strong>56. What is the CDC in SQL?</strong></p><p>CDC Stands for Changed Data Capture. It belongs to the SQL server. It helps to synchronize data between the source to the destination.</p><p>CDC helps us to capture the insert, delete, update activities on the table data. If we enable the CDC in the SQL server it tracks the changes in the SQL server.</p><p><strong>In CT table Column name as Operation display the changed data like –</strong></p><ul><li>Delete → 1</li><li>Insert → 2</li><li>Before update → 3</li><li>After update → 4</li></ul><p><strong>57.</strong> <strong>What is a Transaction?</strong></p><p>A transaction is a group of tasks executed on a database as a single logical unit of work. Either transaction is successful or aborted.</p><p><strong>58.</strong> <strong>What are ACID properties in the Database?</strong></p><p><strong>Atomicity - </strong>All changes to data are performed as if they are a single operation. That is, all the changes are performed, or none of them are.</p><p><strong>Consistency - </strong>Data is in a consistent state when a transaction starts and when it ends.</p><p><strong>Isolation - </strong>The intermediate state of a transaction is invisible to other transactions. As a result, transactions that run concurrently appear to be serialized.</p><p><strong>Durability - </strong>After a transaction successfully completes, changes to data persist and are not undone, even in the event of a system failure.</p><p><strong>59.</strong> <strong>What is Locking?</strong></p><p>when we apply a lock on data then another database user cannot update the data until the lock is released.</p><p>Locks are released by Rollback or Commit SQL statements.</p><p>Lock prevents two or more database users from updating the same data at the same time.</p><p><strong>60.</strong> <strong>What are the types of Locking?</strong></p><p><strong>Update Lock - </strong>Update lock is a lock just before the Exclusive lock. When we put update lock then other transactions do a Select.</p><p><strong>Exclusive Lock - </strong>When a statement modifies data, its transaction holds an exclusive lock on data that prevents other transactions from accessing the data.</p><p><strong>Shared Lock - </strong>Shared Locks are applying during the execution of the select query. Updating the data is not allowed until the shared lock is released.</p><p><strong>61.</strong> <strong>Explain 8kb pages in SQL?</strong></p><p>A database page is an 8 KB chunk of data.</p><p>When we insert any data into a SQL Server database, it saves the data to a series of 8 KB pages in the file.</p><p>If multiple data files in filegroup then SQL Server allocates pages to all data files based on a round-robin mechanism.</p><p><strong>62.</strong> <strong>What is Pivot and Unpivot in SQL?</strong></p><ul><li>Pivot converts data from row-level to column level.</li><li>Unpivot converts data from the column level to the row level.</li></ul><p><strong>63.</strong> <strong>What is Star Schema and Snowflake Schema?</strong></p><ul><li>In a star schema, there is no relation between the dimensions.</li><li>In snowflake schema, there is a relation between the dimensions is a must.</li></ul><p><strong>64.</strong> <strong>What is Audit Trail?</strong></p><p>An audit trail is a set of records in a table or tables, that record all actions taken by a user. It maintains history.</p><p><strong>65.</strong> <strong>Explain Backup and Restore in SQL Server?</strong></p><p><strong>BACKUP –</strong></p><p>Backup is a copy of SQL Server data that can be used to restore and recover the data after a failure.</p><p><strong>RESTORE -</strong></p><p>Restoring is the process of copying data from a backup and applying logged transactions to the data.</p><p>Restore is what you do with backups. Take the backup file and turn it back into a database.</p><p><strong>66.</strong> <strong>What is the different Backup available in SQL Server?</strong></p><ul><li>Full Backup</li><li>Differential Backup</li><li>Transaction Log Backup</li><li>Tail-Log Backup</li><li>File and Filegroup Backup</li><li>Partial Backup</li><li>Copy-Only Backup</li></ul><p><strong>67.</strong> <strong>How to fetch common records from two tables?</strong></p><ul><li><strong>Intersect </strong>— By using Intersect we fetch the Common records only.</li><li><strong>Inner Join</strong> — By using Inner Join we fetch common records with the duplicate records.</li></ul><p><strong>68.</strong> <strong>What is Performance tuning in SQL?</strong></p><p>Performance tuning is the improvement of system performance. Performance tuning includes query optimization, SQL client code optimization, database index management, and in another sense, better coordination between developers and DBAs.</p><p><strong>69.</strong> <strong>What is Union, minus and Intersect commands?</strong></p><p><strong>UNION – </strong>UNION combines the two tables into a single table. It automatically removes duplicate rows from the tables.</p><p><strong>MINUS – </strong>MINUS display the rows that are present in the first table and not in the second table by removing from the results all the rows that are found only in the second table.</p><p><strong>INTERSECT – </strong>INTERSECT display’s the rows that are found in both tables by eliminating rows that are only found in one or the other table.</p><p><strong>70.</strong> <strong>What are RowNumber (), Partition (), Rank () and DenseRank ()?</strong></p><p><strong>RowNumber () - </strong>The ROW_NUMBER function simply returns the row number of the sorted record</p><p><strong>Partition () - </strong>It first group the records and assign the same number to the groups.</p><p><strong>Rank () - </strong>The RANK function is used to retrieve ranked rows based on the condition of the ORDER BY clause.</p><p><strong>DenseRank () - </strong>The DENSE_RANK function does not skip any ranks if there is a tie between the ranks of the preceding records.</p><p><strong>71.</strong> <strong>What is the SELECT statement?</strong></p><p>The SELECT statement is a DML command. The SQL SELECT statement returns a result set of records from one or more tables.</p><p>A SELECT statement retrieves zero or more rows from one or more database tables or database views.</p><p><strong>72.</strong> <strong>What is alter and update statements?</strong></p><p><strong>ALTER - </strong>ALTER is a DDL (Data Definition Language) statement. It updates the structure of the table.</p><p><strong>UPDATE </strong>- UPDATE is a DML (Data Manipulation Language) statement. It updates the data into the existing table.</p><p><strong>73.</strong> <strong>Write a query to find out the highest salary with and without using TOP?</strong></p><p>With using Top -</p><ul><li>Select Top 1 Salary from salary order by Salary DESC</li></ul><p>Without using Top -</p><ul><li>Select Max (Salary) from salary</li></ul><p><strong>74.</strong> <strong>Which are the Operators in SQL?</strong></p><p><strong>Arithmetic Operators -</strong></p><p>+ Add</p><p>- Subtract</p><p>* Multiply</p><p>/ Divide</p><p><strong>Comparison Operators</strong></p><p>= Equal to</p><p>&gt; Greater than</p><p>&lt; Less than</p><p>&gt;= Greater than or equal to</p><p>&lt;= Less than or equal to</p><p><strong>Logical Operators –</strong></p><p>AND TRUE if all the conditions separated by AND is TRUE</p><p>OR TRUE if any of the conditions separated by OR is TRUE</p><p>NOT Displays a record if the condition(s) is NOT TRUE</p><p><strong>Bitwise Operators -</strong></p><p>&amp; Bitwise AND</p><p>| Bitwise OR</p><p>^ Bitwise exclusive OR</p><p><strong>75.</strong> <strong>What is CTE in SQL Server? Delete duplicate records from the table using CTE?</strong></p><p>CTE is stands for Common Table Expression.</p><p>SQL Server defines a temporary result set which we can then use in a Select, Insert, Update or Delete statement.</p><p>It helps us to manage complicated queries. Common Table Expressions are defined within the statement using WITH an operator.</p><p><strong>Delete duplicate records from the table using CTE -</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*S44c6f4HVda0eLlNi990wA.png" /></figure><p><strong>76.</strong> <strong>What is an ALIAS command?</strong></p><p>Aliases are the temporary names given to the table or column for the purpose of a particular SQL query.</p><p>Aliases are created to make table or column names more readable.</p><p><strong>77.</strong> <strong>What are Wild Card operators? why use Like operator?</strong></p><p>A wildcard character is used to substitute one or more characters in a string. Wildcard characters are used with the SQL LIKE operator.</p><p>The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.</p><p><strong>78.</strong> <strong>Write a query whose name starts with ‘a’ with and without using Like operator?</strong></p><p>SELECT * FROM Student where CHARINDEX (‘a’, Name) =1</p><p><strong>79.</strong> <strong>Difference between stuff (), replace () and substring ()?</strong></p><p><strong>STUFF () - </strong>STUFF is used to replace the part of the string with some other string OR It deletes a specified length of characters within a string and replaces it with another set of characters.</p><p><strong>Syntax</strong></p><p>STUFF (string_expression, start, length, string_expression2)</p><p><strong>REPLACE () - </strong>REPLACE is used to replace all the occurrences of the given pattern in a string.</p><p><strong>Syntax</strong></p><p>REPLACE (string_expression, replace, string_expression2)</p><p><strong>SUBSTRING () - </strong>SUBSTRING returns the part of the string from a given string_expression.</p><p><strong>Syntax</strong></p><p>SUBSTRING (string_expression, start, length)</p><p><strong>80.</strong> <strong>Queries on Joins -Inner Joins, Left Joins, Right Joins, Full Outer Joins, Cross Joins?</strong></p><p><strong>INNER JOIN –</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*PA0ZjXl-6NqZm8tScNMmmg.png" /></figure><p><strong>LEFT JOIN –</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*tU-kUgGeNnh90QvJpQd91Q.png" /></figure><p><strong>RIGHT JOIN –</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*W-NC1GsXPboEaAMXOM4m9g.png" /></figure><p><strong>FULL JOIN –</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*uYGy2L7cCR-e0kBPK_IOjQ.png" /></figure><p><strong>CROSS JOIN –</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*t_rmxe-UjxvgZDMs7jw2_A.png" /></figure><p><strong>81. What is the command used to fetch the first 5 characters of the string?</strong></p><p>SELECT SUBSTRING(StudentName,1,5) as stud1 FROM student.</p><p><strong>82.</strong> <strong>What is a Scheduled job in SQL Server?</strong></p><p>We can run the SQL Agent job schedule query that tells what jobs are scheduled to run on an SQL Server system equipped with SQL Server Agent.</p><p>To do so, you will need to join two tables, including one that stores jobs and one that stores schedules, using SQL.</p><p><strong>83. What is Dot Notation in SQL Server?</strong></p><p>Dot notation (sometimes called the membership operator) qualifies an SQL identifier with another SQL identifier of which it is a component.</p><p>Example — Table1.name = Table2.name</p><p><strong>84.</strong> <strong>What is Checkpoint?</strong></p><p>Checkpoint Starts from the point where the things failed. Do not start from first Starts from the last failed point. If you want to Checkpoint first disable the transaction.</p><p><strong>85.</strong> <strong>Which TCP/IP port does SQL Server run on?</strong></p><p>By default, SQL Server runs on Port 1433</p><p><strong>86.</strong> <strong>How can we check the SQL Server version?</strong></p><p>Select @@Version — By using this command we find out the version.</p><p><strong>87.</strong> <strong>Explain types of database and default database.</strong></p><p>Types of the database as follows -</p><p><strong>Centralized database -</strong></p><p>The data is stored at a centralized location and the users from different locations can access this data. Data access by remote Location.</p><p><strong>Hierarchical database -</strong></p><p>Data is organized in a tree-like structure. This parent-child relationship is present. E.g. — Department and Employee relationship.</p><p><strong>Network database -</strong></p><p>The network database has many to many relationships. It allows a child to have multiple parents.</p><p><strong>Personal database -</strong></p><p>Data is collected and stored on personal computers which are small and easily manageable.</p><p>The data is generally used by the same department of an organization and is accessed by a small group of people.</p><p><strong>Cloud database -</strong></p><p>Data is highly stored on a cloud-like hybrid, public or private cloud. Clouds also are known as virtual environments.</p><p>There are so many benefits of storing data on cloud-like — Ability to pay for storage capacity and bandwidth on per user basis, scalability to provide data on-demand, along with high availability.</p><p><strong>Distributed</strong> <strong>database</strong></p><p>It is exactly the opposite of a centralized database. The data is not in one place and is distributed at various sites of an organization.</p><p>These sites are connected to each other with the help of communication links which helps them to access the distributed data easily.</p><p><strong>Relational database</strong></p><p>These databases are categorized by a set of tables where data gets fit into a pre-defined category.</p><p>The table consists of rows and columns where the column has an entry for data for a specific category and rows contains instance for that data defined according to the category.</p><p><strong>Types of default database as follows –</strong></p><ul><li>master</li><li>model</li><li>tempdb</li><li>msdb</li><li>pubs</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/209/1*dd0NlDxgDY2Xp201CPHObA.png" /></figure><p><strong>88.</strong> <strong>What is an execution plan?</strong></p><p>Execution plans can tell you how a query will be executed, or how a query was executed.</p><p>A query plan is an ordered set of steps used to access data in a SQL relational database management system.</p><p><strong><em>If you are new to SQL Server start with the following must-watch video: -</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Fstart%3D1%26feature%3Doembed%26start%3D1&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/23e9ad5a5a5f4cec7d26048767a7305b/href">https://medium.com/media/23e9ad5a5a5f4cec7d26048767a7305b/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cdbc226fdedb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Parent And Child DAX Functions In PowerBI]]></title>
            <link>https://medium.com/@smitagudale712/parent-and-child-dax-functions-in-powerbi-5cbab6b2902b?source=rss-38562e09cd63------2</link>
            <guid isPermaLink="false">https://medium.com/p/5cbab6b2902b</guid>
            <category><![CDATA[pathitemrevers]]></category>
            <category><![CDATA[power-bi-tutorials]]></category>
            <category><![CDATA[path-pathlength]]></category>
            <category><![CDATA[pathitem-pathcontain]]></category>
            <category><![CDATA[parent-child-functions]]></category>
            <dc:creator><![CDATA[Smita Gudale]]></dc:creator>
            <pubDate>Mon, 03 Feb 2020 10:38:04 GMT</pubDate>
            <atom:updated>2020-02-03T10:38:04.381Z</atom:updated>
            <content:encoded><![CDATA[<p>The following DAX functions are used for the manages data in the form of the parent-child relationship.</p><ul><li>PATH()</li><li>PATHCONTAINS()</li><li>PATHITEM()</li><li>PATHITEMREVERSE()</li><li>PATHLENGTH()</li></ul><p>My data is in the table so firstly I have loaded my data from SQL Server →Click on get data →Choose the source →SQL Server→Give server name →Select database →Load the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*944Vzdle1-c2QkqiBShmhQ.png" /><figcaption><strong>DATA</strong></figcaption></figure><p>Create a New Column and write the DAX queries in it →Right click on table →Click on New Column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/190/1*VTwwiB5RyXWMd7RBd4pmVw.png" /><figcaption><strong>Add new column</strong></figcaption></figure><blockquote><strong>PATH() -</strong></blockquote><p>It returns a delimited text string with the identifiers of all the parents of the current identifier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*7DPfPO-SpFcU5V8H_KCU1g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*oLv6SHN3QZgBJoNSwdvirA.png" /><figcaption><strong>PATH</strong></figcaption></figure><blockquote><strong>PATHLENGTH() -</strong></blockquote><p>This function returns the number of parents to the specified item in a given PATH result, including self.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*Tvs1HstiP7IOEYY_lSqw7Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*WC87WIQSCdfy_7P5yWdHng.png" /><figcaption><strong>PATHLENGTH</strong></figcaption></figure><blockquote><strong>PATHCONTAINS() -</strong></blockquote><p>It returns TRUE if the specified item exists within the specified path if it does not exist then it returns FALSE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*iNwqB0jV24C41Q6fKNA_uw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*cxlEEUMVKZzioOdQdDhQpQ.png" /><figcaption><strong>PATHCONTAINS</strong></figcaption></figure><blockquote><strong>PATHITEM() -</strong></blockquote><p>It shows the item at the specified position from left to right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*1iYYGiNX5S0G7qhbaj347Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*iFb4ZEmYrnFblYLlkBp3KQ.png" /><figcaption><strong>PATHITEM</strong></figcaption></figure><blockquote><strong>PATHITEMREVERSE() -</strong></blockquote><p>It shows the item at the specified position from right to left it is exactly opposite of PathItem function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*W9Jfmnhu_QoYmXaMjo5BIA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*CUQmwBXUE7SpnCsysHOmyg.png" /><figcaption><strong>PATHITEMREVERSE</strong></figcaption></figure><p><strong><em>If you are new to SQL Server start with the following must-watch video</em></strong><em> -</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1b92aR55iaI%3Fstart%3D2112%26feature%3Doembed%26start%3D2112&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/b07cdb785b7033cc2987a40b617dbce4/href">https://medium.com/media/b07cdb785b7033cc2987a40b617dbce4/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5cbab6b2902b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Expression and TextBox in SQL Server Reporting Services(SSRS)]]></title>
            <link>https://medium.com/@smitagudale712/expression-and-textbox-in-sql-server-reporting-services-ssrs-41b1a1c1ab6a?source=rss-38562e09cd63------2</link>
            <guid isPermaLink="false">https://medium.com/p/41b1a1c1ab6a</guid>
            <category><![CDATA[learn-reporting-services]]></category>
            <category><![CDATA[ssrs]]></category>
            <category><![CDATA[expression]]></category>
            <category><![CDATA[msbitutorials]]></category>
            <category><![CDATA[textbox]]></category>
            <dc:creator><![CDATA[Smita Gudale]]></dc:creator>
            <pubDate>Wed, 29 Jan 2020 11:27:50 GMT</pubDate>
            <atom:updated>2020-01-29T11:27:50.930Z</atom:updated>
            <content:encoded><![CDATA[<p>The expression is a formula in SSRS that begins with an equal sign (=). Expressions are used in built-in functions, custom code, report and group variables, and user-defined variables.</p><p>The Textbox item can be used to display data from a data source, calculations or expressions, or static data.</p><p>When you drag fields from the Fields list onto the Report Designer, bound textbox items are created. Common expressions can refer to a field in the report.</p><blockquote><strong>Let&#39;s have a look at how to make expressions in SSRS by following steps -</strong></blockquote><ul><li>Firstly Go to the View → Select the ToolBox → Click on TextBox.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/1*h-H7yMG8MZsQvSuAiemFCw.png" /><figcaption><strong>ToolBox</strong></figcaption></figure><ul><li>Then see the TextBox in the following screenshot.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*VgXFc4CBOuSq7MfqAdmTYg.png" /><figcaption><strong>REPORT</strong></figcaption></figure><ul><li>After that → Right-click on the TextBox and → Choose the Expression.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*qvsmU7gTsgaxva1yWbSZ7w.png" /><figcaption><strong>TextBox</strong></figcaption></figure><ul><li>Then, the Expression wizard will be open in this wizard on the left side. There are many categories like functions, operators by using these we can form the expression.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*UbSrYFG9GjO7u3N36llTCg.png" /><figcaption><strong>Expression</strong></figcaption></figure><ul><li>Suppose, I want to add the marks then I will use the SUM function. Then go to the category → Click on Datasets → Click on Dataset1 → Double click on the value.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*0EQ7NaF2KZ4rgvPOI0oXKw.png" /><figcaption><strong>Expression</strong></figcaption></figure><ul><li>Run the project and it will display the sum of marks as shown in follow -</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*XjCnJEsljuH_rRXi1xqv0A.png" /><figcaption><strong>REPORT</strong></figcaption></figure><ul><li>The expression is only used for the value but if we won&#39;t change the background color or font then use the TextBoxProperties.</li><li>Right-click on TextBox → Select TextBoxProperties.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*j9dEGRn_ePIdgFmfH8mnvA.png" /><figcaption><strong>TextBoxProperties</strong></figcaption></figure><ul><li>Then, TextBoxProperties wizard will open → Give the name to the TextBox if you wish.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*eqJB8oG2KSfSMdIDZMCEig.png" /><figcaption><strong>TextBoxProperties</strong></figcaption></figure><ul><li>In the TextBox Properties in Font, there is a font, size, style, the color we can change it as per likes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*DXyKfODLalD7H4gAXPa2BQ.png" /><figcaption><strong>TextBoxProperties</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*-RSgnOiUsONYeQI6gucViA.png" /><figcaption><strong>TextBoxProperties</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*H7Evc8GCjIS3hmVKqTupUg.png" /><figcaption><strong>TextBoxProperties</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*A_Qn_-cImeeGLrtMwSDC5A.png" /><figcaption><strong>TextBoxProperties</strong></figcaption></figure><ul><li>When all properties are set, then run the report it will show background colors, fonts, styles that you have added.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*0pklYuTKzrR3VTajrUn3kw.png" /><figcaption><strong>REPORT</strong></figcaption></figure><ul><li>Here I have changed Body Properties, Font and Style.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*JD81j5YjIVunkU9vQGU4sA.png" /><figcaption><strong>REPORT</strong></figcaption></figure><ul><li>Let&#39;s see what will happen by adding the following expression.</li><li>If the sum is greater than 160 then it has to display the output background color is blue and if not then it has to show background color yellow.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*xs-x9i5rcTuw31xD2LMZzg.png" /><figcaption><strong>Expression</strong></figcaption></figure><ul><li>Run the report and see the output. It satisfies the condition of the expression.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*UT7NGTs1eNKUWgnFA2iatQ.png" /><figcaption><strong>REPORT</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*P725RzgmOG23fXJ4sLMSTQ.png" /><figcaption><strong>REPORT</strong></figcaption></figure><ul><li>Suppose I have to calculate the running total of marks, let&#39;s have a look at the following expression.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*iBrRnF3e-fI2JPqkgyqCYg.png" /><figcaption><strong>Expression</strong></figcaption></figure><ul><li>Right-click and insert the column in the report → Set the expression → Run the report.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*h1C4EJwcDle1L-_wzrqq0w.png" /><figcaption><strong>REPORT</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*1iinXDpDhAK7b83eaF9d8Q.png" /><figcaption><strong>REPORT</strong></figcaption></figure><p><strong><em>If you are new to MSBI, start with the following must-watch video: -</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FmGPJx3ocFgg%3Fstart%3D1%26feature%3Doembed%26start%3D1&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DmGPJx3ocFgg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FmGPJx3ocFgg%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/b6c0081ffbad1a1d8db19f229f1b0fec/href">https://medium.com/media/b6c0081ffbad1a1d8db19f229f1b0fec/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41b1a1c1ab6a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Relational Algebra in Database”]]></title>
            <link>https://medium.com/@smitagudale712/relational-algebra-in-database-1b7adad39e9e?source=rss-38562e09cd63------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b7adad39e9e</guid>
            <category><![CDATA[sql-server-tutorial]]></category>
            <category><![CDATA[cartesian-product]]></category>
            <category><![CDATA[relational-algebra]]></category>
            <category><![CDATA[learn-sql-server]]></category>
            <category><![CDATA[unions]]></category>
            <dc:creator><![CDATA[Smita Gudale]]></dc:creator>
            <pubDate>Wed, 29 Jan 2020 10:57:40 GMT</pubDate>
            <atom:updated>2020-01-29T10:57:40.732Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Relational algebra</em></strong> is a procedural query language.</p><p>Relational algebra is performed recursively on relation and intermediate results are also considered relations. It uses operators to perform queries.</p><blockquote><strong><em>The fundamental operations of the relational algebra are as follows -</em></strong></blockquote><ul><li>Select</li><li>Project</li><li>Union</li><li>Set different</li><li>Cartesian product</li><li>Rename</li></ul><ol><li><strong><em>Select operation:</em></strong></li></ol><p>Select operation is used to select the tuples. It is denoted as <strong>σ<em>.</em></strong></p><p>Notation : <strong>σ<em>p</em>(r)</strong></p><p>where<strong> σ</strong> is selection predicate,</p><p><strong>p </strong>is a propositional logic formula which may connector like and or not.</p><p><strong>r </strong>stands for relation.</p><p><strong><em>2. Project operation:</em></strong></p><p>It projects column(s) that satisfy a given predicate.</p><p>Notation: <strong>∏ A 1, A 2, An (r)</strong></p><p>Where A 1, A 2, An are attribute names of relation <strong>r</strong>.</p><p>Duplicate rows are automatically eliminated, as a relation is a set.</p><p><strong><em>3. Union:</em></strong></p><p>In Union, it combines two tables. r and s must have the same number of attributes.</p><p>It automatically eliminates duplicate tuples in the table.</p><p>Notation: <strong>r U s</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*0zdBdO_-Ulb_WvZcNDQhTg.png" /><figcaption><strong>UNION</strong></figcaption></figure><p><strong>4. Set Difference:</strong></p><p>The result of set difference operation is tuples, which are present in one relation but are not in the second relation.</p><p>Notation : <strong>r -s</strong></p><p>It finds all the tuples that are present in <strong>r</strong> but not in <strong>s</strong>.</p><p><strong><em>5. Cartesian product:</em></strong></p><p>It combines information of two different relations into one.</p><p>Notation: <strong>r Χ s</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/209/1*nV2cPKxSzN1Uayv0DSSM5A.png" /><figcaption><strong><em>Cartesian Product</em></strong></figcaption></figure><p><strong>6.Rename Operation (ρ):</strong></p><p>The results of the relational algebra are also relations but without any name.</p><p>The rename operation allows us to rename the output relation.</p><p>Rename operation is denoted with a small Greek letter <strong>rho</strong><em>ρ</em>.</p><p>Notation − <strong><em>ρ</em> x (E)</strong></p><p>Where the result of expression <strong>E</strong> is saved with the name of <strong>x</strong>.</p><p><strong><em>If you are new to SQL Server start with the following must-watch video: -</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Fstart%3D1%26feature%3Doembed%26start%3D1&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/23e9ad5a5a5f4cec7d26048767a7305b/href">https://medium.com/media/23e9ad5a5a5f4cec7d26048767a7305b/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b7adad39e9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQL Server Agent]]></title>
            <link>https://medium.com/@smitagudale712/sql-server-agent-93cdfa6bd56?source=rss-38562e09cd63------2</link>
            <guid isPermaLink="false">https://medium.com/p/93cdfa6bd56</guid>
            <category><![CDATA[jobs]]></category>
            <category><![CDATA[learn-sql-server]]></category>
            <category><![CDATA[schedule]]></category>
            <category><![CDATA[sql-server-agent]]></category>
            <category><![CDATA[sql-server-tutorial]]></category>
            <dc:creator><![CDATA[Smita Gudale]]></dc:creator>
            <pubDate>Tue, 28 Jan 2020 12:21:04 GMT</pubDate>
            <atom:updated>2020-01-28T12:21:04.161Z</atom:updated>
            <content:encoded><![CDATA[<p>SQL server agent is a software that is provided by the SQL server. Which helps to run any SQL job as a background process.</p><blockquote><strong><em>Steps to Run SQL Agent as follows -</em></strong></blockquote><ul><li>First Start the SQL Server Agent → Right-click on SQL Server Agent → Click on Start → Click on YES → YES.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*uxlpeo527G-0nm9mEm1MCg.png" /></figure><ul><li>SQL Server Agent is started now and it will become a green sign.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*soaK_WE3utVQN7iBpHOgfg.png" /></figure><ul><li>Create a new job → Right-click on jobs → New jobs.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/1*GUzB-akVElTiFpLI9HrNwQ.png" /></figure><ul><li>Give a name to the job</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*q7336qrpnxMr0x2gPUu-rA.png" /></figure><ul><li>Then add the Steps for the Jobs → Click on NEW.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*MhA8QQgQv1hvFOU-FkvSyQ.png" /></figure><ul><li>Give the name to the step → Select the database → Fire a SQL query → OK.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*q8EnQw2sa1FhS9e78uU9wQ.png" /></figure><ul><li>Then add schedule means when you run the cube exactly for eg. 2min</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*6xFpblzHixsY3rf7gDLCXg.png" /></figure><ul><li>Give a name to the Schedule → Set all details → Click on OK.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*aobu9O918nCBrrOLswJKew.png" /></figure><ul><li>Start the job -</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/1*Z8xpUF2uA8HC6jDextCqfA.png" /></figure><ul><li>The job will successfully RUN.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*1llEa7CF5O8ba1EX6q4ciw.png" /></figure><p><strong><em>If you are new to SQL Server start with the following must-watch video: -</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Fstart%3D1%26feature%3Doembed%26start%3D1&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/23e9ad5a5a5f4cec7d26048767a7305b/href">https://medium.com/media/23e9ad5a5a5f4cec7d26048767a7305b/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93cdfa6bd56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Creating Report By Using SQL Server Reporting Services (SSRS)”]]></title>
            <link>https://medium.com/@smitagudale712/creating-report-by-using-sql-server-reporting-services-ssrs-4ec702a3220e?source=rss-38562e09cd63------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ec702a3220e</guid>
            <category><![CDATA[add-parameters]]></category>
            <category><![CDATA[create-ssrs-report]]></category>
            <category><![CDATA[learn-msbi]]></category>
            <category><![CDATA[add-datasets]]></category>
            <category><![CDATA[msbitutorials]]></category>
            <dc:creator><![CDATA[Smita Gudale]]></dc:creator>
            <pubDate>Tue, 28 Jan 2020 12:17:31 GMT</pubDate>
            <atom:updated>2020-01-28T12:17:31.887Z</atom:updated>
            <content:encoded><![CDATA[<p>SSRS is basically used for data displayed out to the end-user. SSRS is a reporting service that fetches the data from the SSAS as well as SQL Server.</p><p>Report Server Project is an empty report template that means he has to build things from scratch. Users can create reports in various forms such as tabular, matrix, free form, charts, etc.</p><p>Reports exist on your server and can be accessed on any web browser. SSRS has a report server.</p><blockquote><strong>Steps for creating SQL Server Reporting Service as follows -</strong></blockquote><ul><li>Go to the Visual Studio → Click on File → Click on New → Project.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*010bthV847sEWS_E0Z_AaA.png" /><figcaption><strong>Microsoft Visual Studio</strong></figcaption></figure><ul><li>Choose the Reporting Services → Choose the Report Server Project, Wizard.</li><li>If you want to browse the path then click on the browser and select the path and rename the project name then click on the OK.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*_GdTE-aHWLAuWW6WeWGJkw.png" /><figcaption><strong>Create a new SSRS project</strong></figcaption></figure><ul><li>When we click on ok then it will open the following wizard → Click on Next.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*KzqAyP4B9orZzNX9tzU7Ow.png" /><figcaption><strong>Click NEXT</strong></figcaption></figure><ul><li>Then it will open the following wizard in which we have to select the data source from which to obtain data for this report → Select the data source.</li><li>SSRS provides us many different types of data sources. Here I have selected Microsoft SQL Server.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*uVjds2oSVMD2eylvb2YcTA.png" /><figcaption><strong>Different types of data sources</strong></figcaption></figure><ul><li>After that click on Edit → Give the Server name → Select the database → Click on OK → Then we get the connection string → to click on next.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*jAOUV6mKaga34CqRLnZy1w.png" /><figcaption><strong>Give the Server name</strong></figcaption></figure><ul><li>It will give a connection string →Click on Next.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*VXp_DAybTI1E1Y5Baoz21Q.png" /><figcaption><strong>Report Wizard</strong></figcaption></figure><ul><li>Then it pops up the Query Builder window → We need to specify a query to get the data for the report → Click on the query builder.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*5xqqcpDOviFunrkJeamQPw.png" /><figcaption><strong>Query Builder</strong></figcaption></figure><ul><li>It will pop up the query designer → Right click on blank space → Add the table → Add → OK.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*gq3Y9qZ-R2cY4RVX8eFk_w.png" /><figcaption><strong>Query Designer</strong></figcaption></figure><ul><li>He has written a SQL query here →Click next.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*teeofP3RSpypfuCHMXEUHg.png" /><figcaption><strong>Query Builder</strong></figcaption></figure><ul><li>Select the type of report that you want to create Tabular or Matrix→Here I have selected Tabular.</li><li>The tabular report is the most basic type of report. Each column relates to a column chosen from the database.</li><li>A matrix report is a cross-tabulation of four groups of data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*zxupGg0bXqPwGMY4PMaetQ.png" /><figcaption><strong>Report Type</strong></figcaption></figure><ul><li>Reports have three types like the page is like header or number→Group is a listwise or country wise data→Details is actual data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*T8V8xU6HU4op6scjyJX9vw.png" /><figcaption><strong>Report Wizard</strong></figcaption></figure><ul><li>Here I will add or data in detail as follows →Click on Details →Next.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*_j3UYT9wAz0mTkg7RtCq5Q.png" /><figcaption><strong>Report Wizard</strong></figcaption></figure><ul><li>Give a name to the Report →Click Finish.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*D5WgU3qH6Uc1dGV6lriIMg.png" /><figcaption><strong>Report Wizard</strong></figcaption></figure><ul><li>Finally, the report is created.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s-jKidqSrPdnqkVxJD2uWg.png" /><figcaption><strong>REPORT</strong></figcaption></figure><p><strong><em>If you are new to MSBI start with the following must-watch video: -</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FmGPJx3ocFgg%3Fstart%3D1%26feature%3Doembed%26start%3D1&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DmGPJx3ocFgg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FmGPJx3ocFgg%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/b6c0081ffbad1a1d8db19f229f1b0fec/href">https://medium.com/media/b6c0081ffbad1a1d8db19f229f1b0fec/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ec702a3220e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Common Table Expression(CTE) in SQL Server”]]></title>
            <link>https://medium.com/@smitagudale712/common-table-expression-cte-in-sql-server-c6dfb8a461ee?source=rss-38562e09cd63------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6dfb8a461ee</guid>
            <category><![CDATA[cte]]></category>
            <category><![CDATA[multiple-cte]]></category>
            <category><![CDATA[sql-server-tutorial]]></category>
            <category><![CDATA[immediate-select-in-cte]]></category>
            <category><![CDATA[learn-sql]]></category>
            <dc:creator><![CDATA[Smita Gudale]]></dc:creator>
            <pubDate>Mon, 27 Jan 2020 12:27:03 GMT</pubDate>
            <atom:updated>2020-01-27T12:27:03.322Z</atom:updated>
            <content:encoded><![CDATA[<p>Common Table Expression(CTE) in SQL Server defines a temporary result set that you can reference within another SELECT, INSERT, UPDATE, DELETE statements immediately follows the CTE.</p><p>CTE creates a recursive query. CTE offers the advantages of improving the readability of SQL.</p><p>CTE is not stored in the database as an object it occurs only in the duration of the query. CTE manages complex queries the query can be divided into separate logical building blocks.</p><blockquote><strong>Steps as follows for Common Table Expression(CTE) -</strong></blockquote><ul><li>In the following table, my data is present.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*cV79i8OWaALl_ZUgl45JAQ.png" /><figcaption><strong>MY TABLE DATA</strong></figcaption></figure><ul><li>To create a CTE we use the WITH keyword followed by CTE name and columns then as with parenthesis.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*Xr7qOJ2kWM_qEcH4zknulg.png" /><figcaption><strong>CTE</strong></figcaption></figure><ul><li>Let&#39;s have a look at how we can define and use the CTE.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*2qaqu4hFsXyrkGFAQLzOFw.png" /><figcaption><strong>DEFINE AND USE CTE</strong></figcaption></figure><blockquote><strong>The number of columns specified in the CTE should match with the select query columns if not then it will throw the error like follows -</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*unWhrkycacQuQzFJ29Yw4A.png" /><figcaption><strong>ERROR</strong></figcaption></figure><blockquote><strong>Select statement NOT Immidetly follows the CTE then it will throw an error as follows -</strong></blockquote><ul><li>If there is nothing in between the CTE and select statement then only it will execute.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*FlLzFiWm4Ud_bJQoytJ5TQ.png" /><figcaption><strong>IF WE IMMEDIATE NOT WRITE SELECT THEN IT WILL SHOW ABOVE ERROR</strong></figcaption></figure><blockquote><strong>Create a multiple Common Table Expressions as follows -</strong></blockquote><ul><li>We can create multiple CTEs by using a single WITH keyword and when first CTE is completed then write second CTE by using comma(,) between them.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*Usy5ZFlhQWthXCrXMttODg.png" /><figcaption><strong>WE CAN WRITE MULTIPLE CTEs</strong></figcaption></figure><p><strong><em>If you are new to SQL Server start with the following must-watch video: -</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Fstart%3D1%26feature%3Doembed%26start%3D1&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/23e9ad5a5a5f4cec7d26048767a7305b/href">https://medium.com/media/23e9ad5a5a5f4cec7d26048767a7305b/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6dfb8a461ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“SQL Queries For Finding Shortest and Longest String And Finding Vowels in The String”]]></title>
            <link>https://medium.com/@smitagudale712/sql-queries-for-finding-shortest-and-longest-string-and-finding-vowels-in-the-string-783a3fdea3cc?source=rss-38562e09cd63------2</link>
            <guid isPermaLink="false">https://medium.com/p/783a3fdea3cc</guid>
            <category><![CDATA[sql-server-tutorial]]></category>
            <category><![CDATA[longest-string]]></category>
            <category><![CDATA[shortest-string]]></category>
            <category><![CDATA[vowels-in-the-string]]></category>
            <category><![CDATA[sql-server]]></category>
            <dc:creator><![CDATA[Smita Gudale]]></dc:creator>
            <pubDate>Wed, 22 Jan 2020 12:30:08 GMT</pubDate>
            <atom:updated>2020-01-22T12:30:08.417Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Query the two NAMES in DISTINCT TABLE with the shortest and longest NAMES, as well as their respective lengths (i.e.: number of characters in the NAME). If there is more than one smallest or largest NAME, choose the one that comes first when ordered alphabetically.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*MuQyEwWyMiQgHOIbXbuQcw.png" /><figcaption><strong>TABLE DATA</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*4-AHibKSalruPCLU10PooQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/224/1*_t5G8W4vRS31UXWJ2LqX9Q.png" /><figcaption><strong>OUTPUT</strong></figcaption></figure><blockquote><strong>Query the list of names with vowels (i.e. A, E, I, O, U) from TABLE. Your result cannot contain duplicates.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*vqOxur4EdtUOvNlV1QNOyw.png" /><figcaption><strong>START WITH VOWELS</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*eMFUHZsSSx4sqy5qrSU6mg.png" /><figcaption><strong>IN THE NAME IF ANY VOWEL IS PRESENT THEN OUTPUT</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*nAXn_y4fLErJpqLVJFkERA.png" /><figcaption><strong>END WITH THE VOWEL</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*sSCer4CDhaR-2iPPDZDmRg.png" /><figcaption><strong>START AND END WITH THE VOWEL</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*QbLUHYcAZA7PS1ZnGBnDtA.png" /><figcaption><strong>NOT START WITH THE VOWELS</strong></figcaption></figure><blockquote><strong>Query the list of names from DISTINCT TABLE that do not start with vowels and do not end with vowels. Your result cannot contain duplicates.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*9lclzjx08zoyIZ5xS56ukg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/37/1*cO9S8pQVFU6hz_l1LXl7Bw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*MpZ0S2wttlYajDFQxzJRsg.png" /><figcaption><strong>OUTPUT</strong></figcaption></figure><blockquote><strong>Query the Name of any student in INFO who scored higher than 74 Marks. Order your output by the last three characters of each name. If two or more students both have names ending in the same last three characters (i.e.: Bobby, Robby, etc.), secondary sort them by ascending ID.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*oBnZqmjaTmrI260pT5sUUg.png" /><figcaption><strong>INFO TABLE DATA IS ABOVE</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*a18hJ3mAUSC5fJsLxmb5Dw.png" /><figcaption><strong>OUTPUT</strong></figcaption></figure><p><strong><em>If you are new to SQL Server start with the following must-watch video: -</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Fstart%3D1%26feature%3Doembed%26start%3D1&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/23e9ad5a5a5f4cec7d26048767a7305b/href">https://medium.com/media/23e9ad5a5a5f4cec7d26048767a7305b/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=783a3fdea3cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“SQL QUERIES INTERVIEW Q & A”]]></title>
            <link>https://medium.com/@smitagudale712/sql-queries-interview-q-a-7563428a20e9?source=rss-38562e09cd63------2</link>
            <guid isPermaLink="false">https://medium.com/p/7563428a20e9</guid>
            <category><![CDATA[sql-server-tutorial]]></category>
            <category><![CDATA[learn-sql]]></category>
            <category><![CDATA[interview-answers]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[complex-queries]]></category>
            <dc:creator><![CDATA[Smita Gudale]]></dc:creator>
            <pubDate>Tue, 21 Jan 2020 11:36:58 GMT</pubDate>
            <atom:updated>2020-01-21T11:36:58.950Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, let&#39;s have a look at complex queries in SQL. In the following EmpDetails table and EmpSalary table original data is present.</p><p>SELECT TOP (1000) [EmpID],[DOJ],[EmpName],[ManagerID]</p><p>FROM [MyDB].[dbo].[EmpDetails]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*XJtV1hAKoUQX4nvC8KRYkQ.png" /><figcaption><strong>EmpDetails Table</strong></figcaption></figure><p>SELECT TOP (1000) [EmpID],[Project],[Salary]</p><p>FROM [MyDB].[dbo].[EmpSalary]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/182/1*YQjFIJnBEoc3dCMUWOk1AQ.png" /><figcaption><strong>EmpSalary Table</strong></figcaption></figure><blockquote><strong>1. Write a SQL query to fetch the count of employees working in project P1.</strong></blockquote><p>SELECT COUNT(*) as CountEmp</p><p>FROM [dbo].[EmpSalary] where [Project]=’P1&#39;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/148/1*EsnQNP9Amx-07yVmEheRhg.png" /><figcaption><strong>Result</strong></figcaption></figure><blockquote><strong>2. Write a SQL query to fetch the count of employee names list project wise.</strong></blockquote><p>SELECT [dbo].[EmpDetails].[EmpName], [dbo].[EmpSalary].[Project],</p><p>COUNT([dbo].[EmpDetails].[EmpName]) AS COUNTeMP</p><p>FROM [dbo].[EmpDetails] LEFT JOIN [dbo].[EmpSalary]</p><p>ON [dbo].[EmpDetails].EmpID=[dbo].[EmpSalary].EmpID</p><p>GROUP BY [dbo].[EmpDetails].[EmpName], [dbo].[EmpSalary].[Project]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*HC43FGFU7rLWscr2nlat5Q.png" /><figcaption><strong>count of employee names list project wise</strong></figcaption></figure><blockquote><strong>3. Write a SQL query to fetch employee names having a salary greater than or equal to 5000 and less than or equal 10000.</strong></blockquote><p>SELECT [EmpName]</p><p>FROM [dbo].[EmpDetails]</p><p>WHERE EmpId IN</p><p>(SELECT EmpId FROM [dbo].[EmpSalary]</p><p>WHERE [Salary] BETWEEN 5000 AND 10000)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*JFwA7ZpqTQouBSR7Gvw62Q.png" /><figcaption><strong>emp name</strong></figcaption></figure><blockquote><strong>4. Write a query to fetch only the first name(string before space) from the EmpName column of EmpDetails table.</strong></blockquote><p>SELECT SUBSTRING([EmpName],0, CHARINDEX(‘ ‘,[EmpName])) as FirstName</p><p>FROM [dbo].[EmpDetails]</p><p><strong>OR</strong></p><p>SELECT LEFT([EmpName], CHARINDEX(‘ ‘,[EmpName]) — 1)</p><p>FROM [dbo].[EmpDetails]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/95/1*eOyEYGpIKirwKmv4psZg4A.png" /><figcaption><strong>OUTPUT</strong></figcaption></figure><blockquote><strong>5. Write a SQL query to fetch only even rows from the table.</strong></blockquote><p>SELECT E.EmpId, E.Project, E.Salary</p><p>FROM (</p><p>SELECT *, Row_Number() OVER(ORDER BY EmpId) AS RowNumber</p><p>FROM [dbo].[EmpSalary]) E</p><p>WHERE E.RowNumber % 2 = 0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/179/1*_j8TXmH3v5qLZoPaGVOYEw.png" /><figcaption><strong>OUTPUT</strong></figcaption></figure><blockquote><strong>6. 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></blockquote><ul><li>If kishori patil’s salary is null even though it should display -</li></ul><p>SELECT A.[EmpID],A.[EmpName], B.[Salary]</p><p>FROM [dbo].[EmpDetails] A</p><p>LEFT JOIN [dbo].[EmpSalary] B</p><p>ON A.[EmpID]=B.[EmpID]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*wRsRzTNqmhe_jtPs3-qYUQ.png" /><figcaption><strong>RESULT</strong></figcaption></figure><blockquote><strong>7. Write a SQL query to fetch all employee records from EmployeeDetails table who have a salary record in EmployeeSalary table.</strong></blockquote><p>SELECT * FROM [dbo].[EmpDetails] A</p><p>WHERE EXISTS (SELECT * FROM [dbo].[EmpSalary] B</p><p>WHERE A.EmpID=B.EmpID)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*WmVQuL9lcDyLiEYRvGGNDw.png" /><figcaption><strong>output</strong></figcaption></figure><blockquote><strong>8. Write a SQL query to fetch duplicate records from a table.</strong></blockquote><p>SELECT * , COUNT(*)AS C FROM [dbo].[EmpSalary]</p><p>GROUP BY [EmpID],[Project],[Salary]</p><p>HAVING COUNT(*)&gt;1</p><p><strong>OR</strong></p><p>SELECT *, ROW_NUMBER() OVER</p><p>(PARTITION BY [EmpID],[Salary] ORDER BY [EmpID],[Salary]) C</p><p>FROM [dbo].[EmpSalary]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/205/1*nI2sGBOH0eurzB5kVs1OkA.png" /><figcaption><strong>No duplicate records are present</strong></figcaption></figure><blockquote><strong>9. Write a SQL query to remove duplicates from a table without using a temporary table.</strong></blockquote><p>DELETE FROM [dbo].[EmpSalary]</p><p>WHERE [EmpID] IN(SELECT COUNT(*)AS C FROM [dbo].[EmpSalary]</p><p>GROUP BY [EmpID],[Project],[Salary]</p><p>HAVING COUNT(*)&gt;1)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/176/1*J6ZXSPyvhu03yEcqbOuBsw.png" /><figcaption><strong>output</strong></figcaption></figure><blockquote><strong>10. Write a SQL query to fetch only odd rows from the table.</strong></blockquote><p>SELECT * FROM (SELECT *, ROW_NUMBER()</p><p>OVER (ORDER BY [EmpID]) AS ROWNUMBER FROM [dbo].[EmpDetails]) A</p><p>WHERE A.ROWNUMBER % 2=1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*Efe0Z_ZRqpAMR3WCQsTzZA.png" /><figcaption><strong>DISPLAY ODD NUMBERS</strong></figcaption></figure><blockquote><strong>11.Write a SQL query to fetch only even rows from the table.</strong></blockquote><p>SELECT * FROM (SELECT *, ROW_NUMBER()</p><p>OVER (ORDER BY [EmpID]) AS ROWNUMBER FROM [dbo].[EmpDetails]) A</p><p>WHERE A.ROWNUMBER % 2=0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*Xgwh5z_x3SYnkM_s793ppg.png" /><figcaption><strong>Display Even no</strong></figcaption></figure><blockquote><strong>12. Write a SQL query to create a new table with data and structure copied from another table.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*usVP1rrC4BXS-oqZotwOmw.png" /><figcaption><strong>OUTPUT</strong></figcaption></figure><blockquote><strong>13. Write a SQL query to create an empty table with the same structure as some other table.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*nGGOOGMu850faZHoXOyVTA.png" /></figure><blockquote><strong>14. Write a SQL query to find the current date-time.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*zkcDwprQmmPw0nWpN6G_2Q.png" /></figure><blockquote><strong>15. Write a SQL query to fetch all the Employees details from EmployeeDetails table who joined in the Year 2020 in month jan and feb only.</strong></blockquote><p>select * from [dbo].[EmpDetails] where [DOJ]</p><p>between ‘2020–01–10’ and ‘2020–02–16’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*9aP8MbfeoOfXeWoYATZiSw.png" /></figure><blockquote><strong>16. Write SQL query to find the 4th highest salary from table without using TOP/limit keyword.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*Hq4tywWld2R1IX25sqAT_A.png" /></figure><p><strong><em>If you are new to SQL Server start with the following must-watch video: -</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Fstart%3D1%26feature%3Doembed%26start%3D1&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/23e9ad5a5a5f4cec7d26048767a7305b/href">https://medium.com/media/23e9ad5a5a5f4cec7d26048767a7305b/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7563428a20e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Local Temp Table and Global Temp Table in SQL Server”]]></title>
            <link>https://medium.com/@smitagudale712/local-temp-table-and-global-temp-table-in-sql-server-97c918d9aae6?source=rss-38562e09cd63------2</link>
            <guid isPermaLink="false">https://medium.com/p/97c918d9aae6</guid>
            <category><![CDATA[scopes]]></category>
            <category><![CDATA[global-temp-table]]></category>
            <category><![CDATA[local-temp-table]]></category>
            <category><![CDATA[learn-sql-server]]></category>
            <category><![CDATA[sql-server-tutorial]]></category>
            <dc:creator><![CDATA[Smita Gudale]]></dc:creator>
            <pubDate>Tue, 14 Jan 2020 11:54:35 GMT</pubDate>
            <atom:updated>2020-01-14T11:54:35.168Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>LOCAL TEMP TABLE-</strong></blockquote><p>A local temporary table is created using a CREATE TABLE statement with the table name prefixed with a single number sign (#table_name).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*3EicjL3Mm5Ac2VDI_Zty0g.png" /><figcaption><strong>Creation of local temp table</strong></figcaption></figure><p>Local temp tables created under the database →system databases →tempdb →temporary tables→inside this local as well as global tables are present.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*_1nand5hfP8EQwfWwauQkA.png" /></figure><p>In SQL Server, local temporary tables are visible only in the current session.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*IwOuKbrYtBgs12nXIx7dFg.png" /><figcaption><strong>Current session</strong></figcaption></figure><p>So if you create a local temporary table in one session, you cannot access it in other sessions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*G8szYdM_5pKZHp2QrcNPSQ.png" /><figcaption><strong>Another session has shown the error message</strong></figcaption></figure><blockquote><strong>LOCAL TEMPRORY TABLE SCOPE -</strong></blockquote><ul><li>If a local temporary table created in a stored procedure, it is dropped automatically when the stored procedure is finished.</li><li>The local temp table is visible only to the connection that creates it and is deleted when the connection is closed.</li></ul><blockquote><strong>GLOBAL TEMP TABLE -</strong></blockquote><p>A global temporary table is created using a CREATE TABLE statement with the table name prefixed with a double number sign (##table_name).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*xEbRsZ2aNkTLSW60Rj1gUg.png" /><figcaption><strong>Global temp table creation</strong></figcaption></figure><p>Global temp tables created under the database →system databases →tempdb →temporary tables→inside this local as well as global tables are present.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/239/1*rq6u7i1xXKojMOcUYnDgqQ.png" /></figure><p>In SQL Server, global temporary tables are visible to all sessions (connections).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*rCiFTl8uVQY2MbFgHWPyGw.png" /></figure><p>So if you create a global temporary table in one session, you can start using it in other sessions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oNsA_-iZM_CX76nbOO3bLQ.png" /></figure><blockquote><strong>GLOBAL TEMPRORY TABLE SCOPE -</strong></blockquote><ul><li>The global temporary table is automatically dropped when the session that created the table ends and the last active Transact-SQL statement (not session) referencing this table in other sessions end.</li><li>Global temp tables are visible to everyone and are deleted when all connections that have referenced them have closed.</li></ul><blockquote><strong>Global temp table Advantage -</strong></blockquote><ul><li>A flexible solution, no need to change applications, data are cleaned automatically.</li></ul><blockquote><strong>Disadvantage -</strong></blockquote><ul><li>More complicated dynamic SQL code, need to resolve conflicts between sessions by using unique table names.</li></ul><p><strong><em>If you are new to SQL Server start with the following must-watch video: -</em></strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuGlfP9o7kmY%3Fstart%3D1%26feature%3Doembed%26start%3D1&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/23e9ad5a5a5f4cec7d26048767a7305b/href">https://medium.com/media/23e9ad5a5a5f4cec7d26048767a7305b/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97c918d9aae6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>