{"id":6156,"date":"2020-10-01T12:18:28","date_gmt":"2020-10-01T12:18:28","guid":{"rendered":"https:\/\/www.temok.com\/blog\/?p=6156"},"modified":"2025-07-21T10:24:25","modified_gmt":"2025-07-21T06:24:25","slug":"sql-interview-questions-and-answers","status":"publish","type":"post","link":"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/","title":{"rendered":"70+ Top SQL Interview Questions And Answers To Get Your Job"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 15<\/span> <span class=\"rt-label rt-postfix\">min read<\/span><\/span>\r\n<p>Relational Database Management System (RDBMS) is one of the best and most commonly used databases, therefore SQL skills are essential in most of the job roles. In this SQL Interview Questions and Answers blog, you will learn the most frequently asked questions on SQL (Structured Query Language).<\/p>\r\n\r\n\r\n\r\n<p>There is a collection of 70+ SQL interview questions that an interviewer plans to ask during an interview process included in this blog. Remember, this blog is not written for only freshers. It is also recommended for experienced candidates for a quick revision of major SQL interview questions before appearing for an interview.<\/p>\r\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69e669db2427a\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69e669db2427a\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#Top_SQL_Interview_Questions_And_Answers\" >Top SQL Interview Questions And Answers<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_DBMS\" >What is DBMS?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_RDBMS\" >What is RDBMS?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_SQL\" >What is SQL?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_MySQL\" >What is MySQL?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Database\" >What is a Database?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#Can_You_Explain_Tables_and_Fields\" >Can You Explain Tables and Fields?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_The_Primary_Key\" >What is The Primary Key?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Unique_Key\" >What is a Unique Key?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Foreign_Key\" >What is a Foreign Key?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Join\" >What is a Join?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_are_the_types_of_join_and_explain_each\" >What are the types of join and explain each?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_Normalization\" >What is Normalization?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_Denormalization\" >What is Denormalization?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_are_all_the_Different_Normalizations\" >What are all the Different Normalizations?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_View\" >What is a View?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_an_Index\" >What is an Index?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_Are_All_The_Different_Types_of_Indexes\" >What Are All The Different Types of Indexes?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Cursor\" >What is a Cursor?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Database_Relationship_And_What_Are_They\" >What is a Database Relationship And What Are They?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Query\" >What is a Query?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_Subquery\" >What is Subquery?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_Are_The_Types_of_Subquery\" >What Are The Types of Subquery?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#Enlist_The_Names_of_Different_Subsets_of_SQL\" >Enlist The Names of Different Subsets of SQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#Explain_DDL_With_its_Examples\" >Explain DDL With its Examples<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-26\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#Explain_DML_With_its_Examples\" >Explain DML With its Examples<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-27\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#Explain_DCL_With_its_Examples\" >Explain DCL With its Examples<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-28\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#Explain_TCL_With_its_Examples\" >Explain TCL With its Examples<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-29\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#Write_a_SQL_Query_to_Display_The_Current_Date\" >Write a SQL Query to Display The Current Date<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-30\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Stored_Procedure\" >What is a Stored Procedure?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-31\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Trigger\" >What is a Trigger?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-32\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_The_Difference_Between_DELETE_and_TRUNCATE_Commands\" >What is The Difference Between DELETE and TRUNCATE Commands?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-33\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_The_Main_Difference_Between_Local_and_Global_Variables\" >What is The Main Difference Between Local and Global Variables?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-34\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Constraint_And_What_Are_The_Common_SQL_Constraints\" >What is a Constraint And What Are The Common SQL Constraints?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-35\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_Data_Integrity\" >What is Data Integrity?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-36\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_Auto_Increment\" >What is Auto Increment?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-37\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_The_Difference_Between_The_Cluster_And_Non-Cluster_Index\" >What is The Difference Between The Cluster And Non-Cluster Index?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-38\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Data_Warehouse\" >What is a Data Warehouse?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-39\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_Self-Join\" >What is Self-Join?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-40\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_Cross-Join\" >What is Cross-Join?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-41\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_are_User_Defined_Functions\" >What are User Defined Functions?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-42\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_Are_All_Types_of_User_Defined_Functions\" >What Are All Types of User Defined Functions?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-43\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_Collation\" >What is Collation?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-44\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_Are_All_Different_Types_of_Collation_Sensitivity\" >What Are All Different Types of Collation Sensitivity?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-45\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_Are_The_Pros_and_Cons_of_Stored_Procedure\" >What Are The Pros and Cons of Stored Procedure?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-46\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_Online_Transaction_Processing_OLTP\" >What is Online Transaction Processing (OLTP)?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-47\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#Define_COMMIT\" >Define COMMIT<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-48\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_CLAUSE\" >What is CLAUSE?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-49\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_The_Difference_Between_Null_Zero_and_Blank_Space\" >What is The Difference Between Null, Zero, and Blank Space?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-50\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Recursive_Stored_Procedure\" >What is a Recursive Stored Procedure?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-51\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_are_Union_Minus_and_Intersect_Commands\" >What are Union, Minus, and Intersect Commands?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-52\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_an_ALIAS_command\" >What is an ALIAS command?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-53\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_Are_Aggregate_And_Scalar_Functions\" >What Are Aggregate And Scalar Functions?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-54\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#How_Can_You_Create_an_Empty_Table_From_an_Existing_Table\" >How Can You Create an Empty Table From an Existing Table?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-55\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#How_to_Fetch_Common_Records_From_Two_Tables\" >How to Fetch Common Records From Two Tables?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-56\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#How_to_Fetch_Alternate_Records_From_a_Table\" >How to Fetch Alternate Records From a Table?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-57\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#How_To_Select_Unique_Records_From_a_Table\" >How To Select Unique Records From a Table?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-58\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_The_Command_Used_to_Fetch_The_First_4_Characters_of_the_String\" >What is The Command Used to Fetch The First 4 Characters of the String?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-59\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Composite_Primary_Key\" >What is a Composite Primary Key?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-60\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#Which_Operator_is_Used_in_Query_For_Pattern_Matching\" >Which Operator is Used in Query For Pattern Matching?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-61\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_Do_You_Mean_by_ROWID\" >What Do You Mean by ROWID?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-62\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_are_Entities_and_Relationships\" >What are Entities and Relationships?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-63\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_are_STUFF_and_REPLACE_Functions\" >What are STUFF and REPLACE Functions?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-64\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_Are_GROUP_Functions_and_Give_Some_Examples\" >What Are GROUP Functions and Give Some Examples?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-65\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_the_MERGE_Statement\" >What is the MERGE Statement?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-66\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_Are_The_Different_Case_Manipulation_Functions_in_SQL\" >What Are The Different Case Manipulation Functions in SQL?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-67\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_Are_The_Character_Manipulation_Functions\" >What Are The Character Manipulation Functions?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-68\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Shared_Lock\" >What is a Shared Lock?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-69\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_a_Deadlock\" >What is a Deadlock?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-70\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_Lock_Escalation\" >What is Lock Escalation?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-71\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#Does_View_Contain_Data\" >Does View Contain Data?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-72\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#What_is_CTE\" >What is CTE?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-73\" href=\"https:\/\/www.temok.com\/blog\/sql-interview-questions-and-answers\/#Final_Words\" >Final Words<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Top_SQL_Interview_Questions_And_Answers\"><\/span>Top SQL Interview Questions And Answers<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_DBMS\"><\/span><strong>What is DBMS?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>DBMS (Database Management System) is software that handles the creation, maintenance, and use of a database. It may include MySQL, SQL Server, Microsoft Access, Oracle, RDBMS, dBASE, and others.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_RDBMS\"><\/span><strong>What is RDBMS?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>RDBMS (Relational Database Management System) is a software that stores the data into the collection of tables in a relationship based on common fields between the columns of the table.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_SQL\"><\/span><strong>What is SQL?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Structured Query Language is an ANSI (American National Standards Institute) standard language used to interact with the database for the execution of different queries for creation, deletion, insertion, and record updates. Don\u2019t forget to understand the difference between<a href=\"https:\/\/blog.temok.com\/static-vs-dynamic-sql\/\" target=\"_blank\" rel=\"noopener\"> static vs dynamic SQL<\/a>.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_MySQL\"><\/span><strong>What is MySQL?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>MySQL is a Relational Database Management System (RDMS) such as SQL Server, Informix, etc., and uses SQL as the standard database language. It is open-source software backed by Oracle and used to deploy cloud-native applications using an open-source database.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Database\"><\/span><strong>What is a Database?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>It is the structured form of data stored in a well-organized manner that can be accessed and manipulated in different ways. The database is based on the collection of schemas, tables, queries, and views. To interact with the database, different database management systems are used. MySQL is used in WordPress and gives you the option to create a MySQL database and its User with the help of a control panel (cPanel).<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Can_You_Explain_Tables_and_Fields\"><\/span><strong>Can You Explain Tables and Fields?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The table is the set of organized data stored in columns and rows. Each database table has a specified number of columns known as fields and several rows which are called records. For example:<\/p>\r\n\r\n\r\n\r\n<p>Table: Student<\/p>\r\n\r\n\r\n\r\n<p>Field: Std ID, Std Name, Date of Birth<\/p>\r\n\r\n\r\n\r\n<p>Data: 23012, William, 10\/11\/1989<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_The_Primary_Key\"><\/span><strong>What is The Primary Key?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The primary key is the combination of fields based on implicit NOT NULL constraint that is used to specify a row uniquely. A table can have only one primary key that can never be NULL.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Unique_Key\"><\/span><strong>What is a Unique Key?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The unique key is the group of one or more fields or columns that uniquely identify the database record. The unique key is the same as a primary key but it accepts the null value.\u00a0<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Foreign_Key\"><\/span><strong>What is a Foreign Key?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The foreign key is used to link two tables together and it is a field that refers to the primary key of another table.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Join\"><\/span><strong>What is a Join?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>As the name indicates, join is the name for combining columns from one or several tables by using common values for each. Whenever the joins are used, the keys play a vital role.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_are_the_types_of_join_and_explain_each\"><\/span><strong>What are the types of join and explain each?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-6164\" src=\"https:\/\/i0.wp.com\/www.blog.temok.com\/wp-content\/uploads\/2020\/10\/w1.jpg?resize=750%2C500&#038;ssl=1\" alt=\"What are the types of join and explain each\" width=\"750\" height=\"500\" srcset=\"https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/w1.jpg?w=750&amp;ssl=1 750w, https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/w1.jpg?resize=300%2C200&amp;ssl=1 300w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>Depending on the relationship between tables, join has the following types:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>Inner Join<\/strong><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>It returns rows when there is at least one match of rows between the tables.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>Right Join<\/strong><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>It returns the common rows between the tables and all rows of the Right-hand side table. In other words, it returns all the rows from the right-hand side table even if there are no matches in the left-hand side table.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>Left Join<\/strong><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>It returns the common rows between the tables and all rows of the left-hand side table. In other words, it returns all the rows from the left-hand side table even if there are no matches in the right-hand side table.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>Full Join<\/strong><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>As the name indicates, full join returns rows when there are matching rows in any one of the tables. It combines the results of both left and right table records and it can return very large result sets.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Normalization\"><\/span><strong>What is Normalization?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Normalization is the process of organizing fields into a related table to increase integrity and remove redundancy to improve the performance of the query. The main aim of the normalization is to add, delete, or modify the fields that can be made in a single table.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Denormalization\"><\/span><strong>What is Denormalization<\/strong>?<span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>It is a technique in which data from higher to lower normal forms are accessed and it is also used to add redundant data to one or more tables.\u00a0\u00a0\u00a0<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_are_all_the_Different_Normalizations\"><\/span><strong>What are all the Different Normalizations?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Following are the different normalization forms:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>First Normal Form (1NF)<\/strong><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>It is the process of removing all the duplicate columns from the table and ensuring that each cell contains only one piece of information. In the first normal form, there are only atomic values without any repeating groups.\u00a0<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>Second Normal Form (2NF)<\/strong><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>A relation is in 2NF if it satisfies the first normal form and does not contain any partial dependency. Moreover, make sure the non-key attributes are fully functional and dependent on the primary key.\u00a0<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>Third Normal Form (3NF)<\/strong><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>Remove the columns that are not dependent on primary key constraints and make sure they meet all the requirements of the second normal form.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>Fourth Normal Form (4NF)<\/strong><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>It should not have multi-valued dependencies and meet all the requirements of the third normal form.<\/p>\r\n\r\n\r\n\r\n<p>It depends on the interviewers, they can only ask a single form of normalization or all of their SQL interview questions.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_View\"><\/span><strong>What is a View?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The view is a virtual table that consists of the subset of data contained in a table and takes less space to store. It can have data from multiple tables depending on the relationship.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_an_Index\"><\/span><strong>What is an Index?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The index is the method of creating an entry for each value to retrieve the records from the table faster. It is a valuable performance-tuning method used for faster retrievals.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Are_All_The_Different_Types_of_Indexes\"><\/span><strong>What Are All The Different Types of Indexes?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>There are three types of indexes:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>Unique Index<\/strong><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>The unique index ensures the index key column has unique values and it applies automatically if the primary key is defined. In case, the unique index has multiple columns then the combination of values in these columns should be unique.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>Clustered Index<\/strong><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>A clustered index reorders the physical order of a table and searches based on its key values. Keep in mind, that each table can have only one clustered index.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>Non-Clustered Index<\/strong><\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>Non-clustered index does not alter the physical order but maintains a logical order of table data. Each table in the non-clustered index can have 999 indexes.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Cursor\"><\/span><strong>What is a Cursor?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The cursor is known as the control of the database that enables traversal over the rows in the table. It is a very useful tool for different operations such as retrieval, addition, and removal of database records. You can view the cursor as a pointer to one row in a set of rows.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-6166\" src=\"https:\/\/i0.wp.com\/www.blog.temok.com\/wp-content\/uploads\/2020\/10\/t2.jpg?resize=750%2C500&#038;ssl=1\" alt=\"What is a Cursor\" width=\"750\" height=\"500\" srcset=\"https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/t2.jpg?w=750&amp;ssl=1 750w, https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/t2.jpg?resize=300%2C200&amp;ssl=1 300w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Database_Relationship_And_What_Are_They\"><\/span><strong>What is a Database Relationship And What Are They?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The database relationship is the connection between the tables of any particular database. The following are the main types of relationships:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>One-to-One Relationship<\/li>\r\n<li>One-to-Many Relationship<\/li>\r\n<li>Many-to-One Relationship<\/li>\r\n<li>Self-Referencing Relationship<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Query\"><\/span><strong>What is a Query?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The <a href=\"https:\/\/en.wikipedia.org\/wiki\/Wikipedia:Database_queries\" target=\"_blank\" rel=\"noopener\">database query<\/a> is the name of getting information back from the database with the help of coding. We can get expected results from the database without wasting our valuable time because the query gives us output within a short period.\u00a0\u00a0\u00a0<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Subquery\"><\/span><strong>What is Subquery?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>As the name indicates, it is also a query but used in another query. The outer query is known as the main query and the inner query is called a subquery. The subquery will be executed first and pass the results to the main query then the output of both queries will be displayed.\u00a0<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Are_The_Types_of_Subquery\"><\/span><strong>What Are The Types of Subquery?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Correlated and non-correlated are the types of subquery where the non-correlated query is considered an independent query and correlated is treated as a dependent query.\u00a0<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Enlist_The_Names_of_Different_Subsets_of_SQL\"><\/span><strong>Enlist The Names of Different Subsets of SQL<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>There are four subsets of SQL:<\/p>\r\n\r\n\r\n\r\n<ol class=\"wp-block-list\">\r\n<li>DDL (Data Definition Language)<\/li>\r\n<li>\u00a0DML (Data Manipulation Language)<\/li>\r\n<li>DCL (Data Control Language)<\/li>\r\n<li>TCL (Transaction Control Language)<\/li>\r\n<\/ol>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Explain_DDL_With_its_Examples\"><\/span><strong>Explain DDL With its Examples<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>As the name indicates, Data Definition Language (DDL) is used to define the structure of data, table, schema, and modify it. For example:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>CREATE: is used to create tables, databases, schema, etc.<\/li>\r\n<li>DROP: is used to drop\/remove tables and other database objects.<\/li>\r\n<li>ALTER: is used to alter or change the definition of database objects.<\/li>\r\n<li>TRUNCATE: This is used to remove tables, procedures, and other database objects.<\/li>\r\n<li>ADD COLUMN: This is used to add any column to the table schema.<\/li>\r\n<li>DROP COLUMN: This is used to drop a column from any database table structure.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Explain_DML_With_its_Examples\"><\/span><strong>Explain DML With its Examples<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>DML (Data Manipulation Language) is a computer programming language used for the addition (insertion), deletion, and modification of data in the database. For example:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>SELECT INTO: is used to select data from one table and insert it into another table.<\/li>\r\n<li>INSERT: is used to insert data or records into a table.<\/li>\r\n<li>DELETE: This is used to delete records from any database table.<\/li>\r\n<li>UPDATE: This is used to update the values of different records in the database.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Explain_DCL_With_its_Examples\"><\/span><strong>Explain DCL With its Examples<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>DCL (Data Control Language) deals with the access rights and permission control of the database.<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>GRANT command is used to grant access rights to database objects.<\/li>\r\n<li>REVOKE is used to withdraw permission from database objects.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Explain_TCL_With_its_Examples\"><\/span><strong>Explain TCL With its Examples<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>TCL (Transaction Control Language) is a set of commands used to perform a specific task on objects in a single unit of execution. In simple words, TCL commands deal with transactions in a database. For example:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>COMMIT: is used to commit transactions. Once a commit is made it cannot be rolled back, so the previous image of the database cannot be retrieved before running this transaction.<\/li>\r\n<li>ROLLBACK: is used to revert the steps in transactions if an error arises.<\/li>\r\n<li>SAVEPOINT: is used to set the savepoint in the transaction to which steps can be rolled back.<\/li>\r\n<li>SET TRANSACTION: This is used to set the characteristics of the transaction.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Write_a_SQL_Query_to_Display_The_Current_Date\"><\/span><strong>Write a SQL Query to Display The Current Date<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Following SQL query is used to return the database system date and time:<\/p>\r\n\r\n\r\n\r\n<p>SELECT GETDATE();<\/p>\r\n\r\n\r\n\r\n<p>This type of short query is asked in the SQL interview questions so that they can understand the candidate\u2019s knowledge and hands-on experience.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Stored_Procedure\"><\/span><strong>What is a Stored Procedure?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>It is a subroutine available to applications that need to access a relational database management system (RDBMS). These procedures are stored in the data dictionary and only executed in the database which is considered a big disadvantage because it occupies more memory in the database server. Moreover, it provides security and functionality to those users who are unable to access data directly, so they can be granted access via stored procedures.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-6170\" src=\"https:\/\/i0.wp.com\/www.blog.temok.com\/wp-content\/uploads\/2020\/10\/t6.jpg?resize=750%2C500&#038;ssl=1\" alt=\"What is a Stored Procedure\" width=\"750\" height=\"500\" srcset=\"https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/t6.jpg?w=750&amp;ssl=1 750w, https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/t6.jpg?resize=300%2C200&amp;ssl=1 300w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Trigger\"><\/span><strong>What is a Trigger?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>A database trigger is a code or program that helps to maintain the integrity of the database. It automatically executes the response to particular events on a table in the database.<\/p>\r\n\r\n\r\n\r\n<p>For example, when a new employee is added to the employee database, new records should be created in the related tables like Salary, Attendance, and Bonus tables.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_The_Difference_Between_DELETE_and_TRUNCATE_Commands\"><\/span><strong>What is The Difference Between DELETE and TRUNCATE Commands?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>TRUNCATE command removes all the table rows permanently that can never be rolled back. DELETE command is also used to remove the rows from the table but commit and rollback can be performed after the deletion. Moreover, the WHERE clause is also used as a conditional parameter.\u00a0<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_The_Main_Difference_Between_Local_and_Global_Variables\"><\/span><strong>What is The Main Difference Between Local and Global Variables?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>As the name indicates, the local variables can be used inside the function but global ones are used throughout the program. Local variables are only limited to the function and cannot be referred to or used with other functions.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Constraint_And_What_Are_The_Common_SQL_Constraints\"><\/span><strong>What is a Constraint And What Are The Common SQL Constraints?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>SQL constraint is used to specify the rules for data in a table and can be specified while creating or altering the table statement. The following are the most widely used constraints:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>NOT NULL<\/li>\r\n<li>CHECK<\/li>\r\n<li>DEFAULT<\/li>\r\n<li>UNIQUE<\/li>\r\n<li>PRIMARY KEY<\/li>\r\n<li>FOREIGN KEY<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Data_Integrity\"><\/span><strong>What is Data Integrity?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Data integrity is the overall accuracy, completeness, and consistency of data stored in a database. For example, to maintain data integrity, the numeric columns\/sales should not accept alphabetic data.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Auto_Increment\"><\/span><strong>What is Auto Increment?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Auto increment allows the users to create a unique number to be generated whenever a new record is inserted into the table. It helps to keep the primary key unique for each row or record. If you are using Oracle then the AUTO INCREMENT keyword should be used otherwise use the IDENTITY keyword in the case of the SQL Server.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_The_Difference_Between_The_Cluster_And_Non-Cluster_Index\"><\/span><strong>What is The Difference Between The Cluster And Non-Cluster Index?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The clustered index defines the order in which data is physically stored in a database table and used for easy retrieval by altering the way that the records are stored.<\/p>\r\n\r\n\r\n\r\n<p>The non-clustered index improves the speed of data retrieval from database tables but stores data separately from the data rows. It makes a copy of selected columns of data with the links to the associated table.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Data_Warehouse\"><\/span><strong>What is a Data Warehouse?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>It is the name of a central repository of data from multiple information sources for analytics and business intelligence activities. Datawarehouse has an enterprise-wide depth and is based on its subsets called data marts which are oriented to a specific business line or team.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Self-Join\"><\/span><strong>What is Self-Join?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>A self-join SQL query is used to compare to itself and values in a column are compared with other values in the same column in the same database table.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-6165\" src=\"https:\/\/i0.wp.com\/www.blog.temok.com\/wp-content\/uploads\/2020\/10\/t1.jpg?resize=750%2C500&#038;ssl=1\" alt=\"What is Self-Join\" width=\"750\" height=\"500\" srcset=\"https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/t1.jpg?w=750&amp;ssl=1 750w, https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/t1.jpg?resize=300%2C200&amp;ssl=1 300w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Cross-Join\"><\/span><strong>What is Cross-Join?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Cross-join is used to generate a paired combination of each row of table A with each row of table B. If the WHERE clause is used in cross join then the SQL query will work like an INNER JOIN.\u00a0<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_are_User_Defined_Functions\"><\/span><strong>What are User Defined Functions?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Like functions in programming languages, SQL user-defined functions are routines or functions that accept parameters, act, such as a complex calculation, and return the output of that particular action as a value. There is no need to write the same logic several times because the function can be called whenever needed.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Are_All_Types_of_User_Defined_Functions\"><\/span><strong>What Are All Types of User Defined Functions?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The following are the user-defined functions:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Scalar Functions that return the unit or single-valued results<\/li>\r\n<li>Inline Table-valued functions that return the table as a return<\/li>\r\n<li>Multi-statement valued functions that return table as a return<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Collation\"><\/span><strong>What is Collation?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Collation provides a set of rules that determine how character data can be sorted and compared in a database. It also provides the case and accent sensitivity properties. Collation is used to compare A and other language characters with the help of ASCII value.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Are_All_Different_Types_of_Collation_Sensitivity\"><\/span><strong>What Are All Different Types of Collation Sensitivity?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Following are the different types of collation sensitivity:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Case Sensitivity (A &amp; a, B &amp; b, or any other uppercase and lowercase letters)<\/li>\r\n<li>Accent Sensitivity<\/li>\r\n<li>Kana Sensitivity (Japanese Kana characters)<\/li>\r\n<li>Width Sensitivity (Single byte character (half-width) &amp; same character represented as a double-byte character)<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Are_The_Pros_and_Cons_of_Stored_Procedure\"><\/span><strong>What Are The Pros and Cons of Stored Procedure?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The stored procedure is based on modular programming which means create once, store, and call several times whenever you need it. It supports faster execution and reduces the network traffic for optimum performance.<\/p>\r\n\r\n\r\n\r\n<p>The main disadvantage of the stored procedure is that it is executed only in the database and utilizes more memory.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Online_Transaction_Processing_OLTP\"><\/span><strong>What is Online Transaction Processing (OLTP)?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-6169\" src=\"https:\/\/i0.wp.com\/www.blog.temok.com\/wp-content\/uploads\/2020\/10\/t5.jpg?resize=750%2C500&#038;ssl=1\" alt=\"What is Online Transaction Processing (OLTP)\" width=\"750\" height=\"500\" srcset=\"https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/t5.jpg?w=750&amp;ssl=1 750w, https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/t5.jpg?resize=300%2C200&amp;ssl=1 300w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>As the name indicates, Online Transaction Processing (OLTP) is used to manage transaction-based applications that can be used for data entry, retrieval, and processing. It makes data management simple and efficient which is the reason why bank transactions are using OLTP. You can view an insight into the workings of an OLTP system.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Define_COMMIT\"><\/span><strong>Define COMMIT<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>COMMIT command is used to save all the transactions to the database since the last COMMIT or ROLLBACK command where a transaction is a unit of work performed against any database.<\/p>\r\n\r\n\r\n\r\n<p>Here is the syntax of the COMMIT command:<\/p>\r\n\r\n\r\n\r\n<p>COMMIT;<\/p>\r\n\r\n\r\n\r\n<p>Consider an example of the deletion of those records which have age = 25 and then COMMIT the changes in the database.<\/p>\r\n\r\n\r\n\r\n<p>SQL&gt; DELETE FROM CUSTOMERS<\/p>\r\n\r\n\r\n\r\n<p>WHERE AGE = 25;<\/p>\r\n\r\n\r\n\r\n<p>SQL&gt; COMMIT;<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_CLAUSE\"><\/span><strong>What is CLAUSE?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>SQL clause is used to filter some rows from the whole set of records with the help of different conditional statements. For example, WHERE and HAVING conditions.\u00a0<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_The_Difference_Between_Null_Zero_and_Blank_Space\"><\/span><strong>What is The Difference Between Null, Zero, and Blank Space?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Null is neither the same as zero nor blank space because it represents a value that is unavailable, unknown, or not applicable at the moment. Whereas zero is a number and blank space belongs to characters.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Recursive_Stored_Procedure\"><\/span><strong>What is a Recursive Stored Procedure?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>It is the same as stored procedures but it calls by itself until it reaches any boundary condition. So, it is the main reason why programmers use recursive stored procedures to repeat their code any number of times.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_are_Union_Minus_and_Intersect_Commands\"><\/span><strong>What are Union, Minus, and Intersect Commands?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Union operator is used to combine the results of two tables and remove the duplicate rows. Minus is used to return matching records of the first and second queries and other rows from the first query but not by the second one. The Intersect operator is used to return the common rows returned by the two select statements.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_an_ALIAS_command\"><\/span><strong>What is an ALIAS command?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>ALIAS name can be given to a column or table and referred to in the WHERE clause to identify the column or table. Alias column syntax:<\/p>\r\n\r\n\r\n\r\n<p>SELECT <em>column_name<\/em> AS <em>alias_name<\/em><\/p>\r\n\r\n\r\n\r\n<p>FROM <em>table_name;<\/em><\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Are_Aggregate_And_Scalar_Functions\"><\/span><strong>What Are Aggregate And Scalar Functions?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The aggregate function performs mathematical calculations against a collection of values and returns a single summarizing value. The scalar function returns a single value based on the input value.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_Can_You_Create_an_Empty_Table_From_an_Existing_Table\"><\/span><strong>How Can You Create an Empty Table From an Existing Table?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>With the help of the following command, we can create an empty table from an existing table with the same structure with no rows copied:<\/p>\r\n\r\n\r\n\r\n<p>Select * into copytable from student where 1=2<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Fetch_Common_Records_From_Two_Tables\"><\/span><strong>How to Fetch Common Records From Two Tables?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Common records can be achieved by the following command:<\/p>\r\n\r\n\r\n\r\n<p>Select studID from student INTERSECT Select StudID from Exam<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Fetch_Alternate_Records_From_a_Table\"><\/span><strong>How to Fetch Alternate Records From a Table?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Records can be fetched for both Odd and Even row numbers with the following commands:<\/p>\r\n\r\n\r\n\r\n<p>For even numbers:<\/p>\r\n\r\n\r\n\r\n<p>Select studentId from (Select rownum, studentId from student) where mod(rowno,2)=0<\/p>\r\n\r\n\r\n\r\n<p>For odd numbers:<\/p>\r\n\r\n\r\n\r\n<p>Select studentId from (Select rownum, studentId from student) where mod(rowno,2)=1<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_To_Select_Unique_Records_From_a_Table\"><\/span><strong>How To Select Unique Records From a Table?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Apply the following SQL query to select unique records from any table:<\/p>\r\n\r\n\r\n\r\n<p>Select DISTINCT StudentID, StudentName from Student<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_The_Command_Used_to_Fetch_The_First_4_Characters_of_the_String\"><\/span><strong>What is The Command Used to Fetch The First 4 Characters of the String?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Following are the ways to fetch the first 4 characters of the string:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Select SUBSTRING(StudentName,1,4) as studentname from student<\/li>\r\n<li>Select LEFT(Studentname,4) as studentname from student<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Composite_Primary_Key\"><\/span><strong>What is a Composite Primary Key?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The primary key that is created on more than one column is known as the composite primary key.\u00a0\u00a0<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Which_Operator_is_Used_in_Query_For_Pattern_Matching\"><\/span><strong>Which Operator is Used in Query For Pattern Matching?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>LIKE operator is used for pattern matching.<\/p>\r\n\r\n\r\n\r\n<p>% (percent sign) Matches zero or more characters and _ (Underscore) is used for matching exactly one character. For example:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>Select * from Student where studentname like &#8216;m%&#8217;<\/li>\r\n<li>Select * from Student where studentname like &#8216;meh_&#8217;<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Do_You_Mean_by_ROWID\"><\/span><strong>What Do You Mean by ROWID?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>ROWID is an 18-character-long pseudo column attached to each row of a database table.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_are_Entities_and_Relationships\"><\/span><strong>What are Entities and Relationships?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The entity is the name of real-world objects either tangible or intangible and it is the key element of relational databases. For a database entity, workflow and tables are optional but properties are necessary. For example: In the database of any institute, students, professors, workers, departments, and projects can be known as entities. Each entity has associated properties that offer it an identity.<\/p>\r\n\r\n\r\n\r\n<p>The relationship is the name of links or relations between entities that have something to do with each other. For example, the employee table should be associated with the salary table in the company\u2019s database.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-6168\" src=\"https:\/\/i0.wp.com\/www.blog.temok.com\/wp-content\/uploads\/2020\/10\/t4.jpg?resize=750%2C500&#038;ssl=1\" alt=\"What are Entities and Relationships\" width=\"750\" height=\"500\" srcset=\"https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/t4.jpg?w=750&amp;ssl=1 750w, https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/t4.jpg?resize=300%2C200&amp;ssl=1 300w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_are_STUFF_and_REPLACE_Functions\"><\/span><strong>What are STUFF and REPLACE Functions?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The STUFF Function is used to insert a string into another string or overwrite existing characters.\u00a0<\/p>\r\n\r\n\r\n\r\n<p><strong>Syntax:<\/strong><\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>STUFF(string_expression,start, length, replacement_characters)<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>REPLACE function is used to replace any existing characters of all the occurrences.<\/p>\r\n\r\n\r\n\r\n<p><strong>Syntax:<\/strong><\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li>REPLACE (string_expression, search_string, replacement_string)<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Are_GROUP_Functions_and_Give_Some_Examples\"><\/span><strong>What Are GROUP Functions and Give Some Examples?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Group functions are mathematical functions used to work on a set of rows and return one result per group. AVG, COUNT, SUM, VARIANCE, MAX, and MIN are the most commonly used Group functions.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_the_MERGE_Statement\"><\/span><strong>What is the MERGE Statement?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>MERGE statement is used to combine insert, delete, and update operations into one statement. It is also used to synchronize two tables and make the changes in one table based on values matched from another.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Are_The_Different_Case_Manipulation_Functions_in_SQL\"><\/span><strong>What Are The Different Case Manipulation Functions in SQL?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Following are the case manipulation functions in SQL:<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>LOWER:<\/strong> This function takes a string as an argument and returns it by converting it into a lowercase string.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p><strong>Syntax:<\/strong><\/p>\r\n\r\n\r\n\r\n<p>LOWER(\u2018string\u2019)<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>UPPER:<\/strong> This function takes a string as an argument and returns it into the uppercase string. Syntax:<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>UPPER(\u2018string\u2019)<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><strong>INITCAP:<\/strong> This function returns the string with the first letter in uppercase and others in lowercase.<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p><strong>Syntax:<\/strong><\/p>\r\n\r\n\r\n\r\n<p>INITCAP(\u2018string\u2019)<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_Are_The_Character_Manipulation_Functions\"><\/span><strong>What Are The Character Manipulation Functions?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p><strong>Character-Manipulative Functions<\/strong><\/p>\r\n\r\n\r\n\r\n<p><strong>1. CONCAT:<\/strong> This function is used to append or concatenate string2 to the end of string1.<\/p>\r\n\r\n\r\n\r\n<p><strong>Syntax:<\/strong><\/p>\r\n\r\n\r\n\r\n<p>CONCAT(&#8216;String1&#8217;, &#8216;String2&#8217;)<\/p>\r\n\r\n\r\n\r\n<p><strong>2. LENGTH:<\/strong> This function returns the total length of the input string used.<\/p>\r\n\r\n\r\n\r\n<p><strong>Syntax:<\/strong><\/p>\r\n\r\n\r\n\r\n<p>LENGTH(Column|Expression)<\/p>\r\n\r\n\r\n\r\n<p><strong>3. SUBSTR: <\/strong>This function will return a portion of a string from any given start point to an endpoint.<\/p>\r\n\r\n\r\n\r\n<p><strong>Syntax:<\/strong><\/p>\r\n\r\n\r\n\r\n<p>SUBSTR(&#8216;String&#8217;,start-index,length_of_extracted_string)<\/p>\r\n\r\n\r\n\r\n<p><strong>4. INSTR:<\/strong> This function is used to return the numeric position of a character (or a string) in any given string.<\/p>\r\n\r\n\r\n\r\n<p><strong>Syntax:<\/strong><\/p>\r\n\r\n\r\n\r\n<p>INSTR(Column|Expression, &#8216;String&#8217;, [,m], [n])<\/p>\r\n\r\n\r\n\r\n<p><strong>5. LPAD and RPAD:<\/strong> LPAD returns the strings padded to the left and RPAD to the right (as per the use.<\/p>\r\n\r\n\r\n\r\n<p><strong>Syntax:<\/strong><\/p>\r\n\r\n\r\n\r\n<p>LPAD(Column|Expression, n, &#8216;String&#8217;)<\/p>\r\n\r\n\r\n\r\n<p><strong>Syntax:<\/strong><\/p>\r\n\r\n\r\n\r\n<p>RPAD(Column|Expression, n, &#8216;String&#8217;)<\/p>\r\n\r\n\r\n\r\n<p><strong>6. TRIM: <\/strong>This function is used to trim the string input from the start or end (or both).<\/p>\r\n\r\n\r\n\r\n<p><strong>Syntax:<\/strong><\/p>\r\n\r\n\r\n\r\n<p>TRIM(Leading|Trailing|Both, trim_character FROM trim_source)<\/p>\r\n\r\n\r\n\r\n<p><strong>7. REPLACE: <\/strong>As the name indicates the REPLACE function searches for a character string and, if found, replaces it with a given replacement string at all the occurrences.<\/p>\r\n\r\n\r\n\r\n<p><strong>Syntax:<\/strong><\/p>\r\n\r\n\r\n\r\n<p><strong>REPLACE(Text, search_string, replacement_string)<\/strong><\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Shared_Lock\"><\/span><strong>What is a Shared Lock?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>The shared lock doesn\u2019t cause many problems and occurs when the object needs to be read. It comes when two transactions are granted and read access. There is no conflict because noting is being updated due to the read-only mode of both transactions.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Deadlock\"><\/span><strong>What is a Deadlock?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>A deadlock situation is created when two processes are competing for access to a resource but are unable to obtain it because the other process is preventing it. So, the process cannot proceed until one of the processes is terminated.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-6167\" src=\"https:\/\/i0.wp.com\/www.blog.temok.com\/wp-content\/uploads\/2020\/10\/t3.jpg?resize=750%2C500&#038;ssl=1\" alt=\"What is a Deadlock\" width=\"750\" height=\"500\" srcset=\"https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/t3.jpg?w=750&amp;ssl=1 750w, https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/t3.jpg?resize=300%2C200&amp;ssl=1 300w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\r\n\r\n\r\n\r\n<p>For example: Process A locks Table A and Process B locks Table B. Now Process A requests Table B and waiting for it and Process B is also waiting for Table A.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Lock_Escalation\"><\/span><strong>What is Lock Escalation?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>Lock escalation is an optimization technique used to convert many fine-grained locks such as row or page locks into table locks for handling large updates. SQL Server uses row-level locking by default, so it is easier to convert a large number of row locks into a single table lock for optimum results.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Does_View_Contain_Data\"><\/span><strong>Does View Contain Data?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>No, because views are virtual structures.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_CTE\"><\/span><strong>What is CTE?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\r\n\r\n\r\n\r\n<p>A Common Table Expression (CTE) is an expression that contains temporary results defined in a SQL statement.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Final_Words\"><\/span><strong>Final Words<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<p>These SQL interview questions and answers are not enough to pass out your interviews conducted by the top business brands. So, it is highly recommended to keep practicing your theoretical knowledge to enhance your performance. Keep in mind, \u201cpractice makes a man perfect\u201d.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 15<\/span> <span class=\"rt-label rt-postfix\">min read<\/span><\/span>Relational Database Management System (RDBMS) is one of the best and most commonly used databases, therefore SQL skills are essential in most of the job roles. In this SQL Interview Questions and Answers blog, you will learn the most frequently asked questions on SQL (Structured Query Language). There is a collection of 70+ SQL interview [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":6162,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"pmpro_default_level":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[442],"tags":[725,726,459,3238],"class_list":["post-6156","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technical-interviews","tag-sql-interview-questions","tag-sql-questions-and-answers","tag-structured-query-language","tag-top-sql-interview-questions-and-answers","pmpro-has-access"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/blog.temok.com\/wp-content\/uploads\/2020\/10\/feat1.jpg?fit=750%2C500&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.temok.com\/blog\/wp-json\/wp\/v2\/posts\/6156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.temok.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.temok.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.temok.com\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.temok.com\/blog\/wp-json\/wp\/v2\/comments?post=6156"}],"version-history":[{"count":13,"href":"https:\/\/www.temok.com\/blog\/wp-json\/wp\/v2\/posts\/6156\/revisions"}],"predecessor-version":[{"id":16604,"href":"https:\/\/www.temok.com\/blog\/wp-json\/wp\/v2\/posts\/6156\/revisions\/16604"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.temok.com\/blog\/wp-json\/wp\/v2\/media\/6162"}],"wp:attachment":[{"href":"https:\/\/www.temok.com\/blog\/wp-json\/wp\/v2\/media?parent=6156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.temok.com\/blog\/wp-json\/wp\/v2\/categories?post=6156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.temok.com\/blog\/wp-json\/wp\/v2\/tags?post=6156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}