[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-718161-105":3,"detail-sidebar-cat-0-en-105":81,"doc-detail-718161-en":130,"doc-similar-718161":166},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":74,"head_meta":76,"extra_data":78,"updated_unix":80},105,"en","sql-interview-questions-and-answers-most-frequently-asked-sql-interview-questions","SQL Interview Questions and Answers - Most Frequently Asked SQL Interview Questions","","A focused set of SQL interview questions and model answers covering core database concepts and query behavior. Topics include differences between stored procedures and functions, clustered vs non-clustered indexes, DELETE vs TRUNCATE semantics, and WHERE vs HAVING clause usage. The answers explain constraints, locking and transaction behavior, trigger activation, execution order with GROUP BY, and rules around aggregate functions, providing practical guidance for interview-style problem solving.",{"@graph":14,"@context":73},[15,34,56],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/exam/","Exam",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/sql-interview-questions-and-answers-most-frequently-asked-sql-interview-questions/718161/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/sql-interview-questions-and-answers-most-frequently-asked-sql-interview-questions/718161.png","ImageObject",300,407,{"name":42,"@type":43},"Finn","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-12-02","2026-11-16",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",6,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"What is the difference between a Stored Procedure and a Function?","Question",{"text":63,"@type":64},"A procedure can take input and output parameters, and it can use DML in its body. A function cannot use DML, and it can be used inside a SELECT statement, unlike a stored procedure.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"What is the difference between DELETE and TRUNCATE?",{"text":68,"@type":64},"DELETE removes selected rows based on a WHERE condition and is logged row-by-row with row locks. TRUNCATE removes all rows using table-level locks, is a DDL operation, and deallocates data pages rather than deleting row-by-row.",{"name":70,"@type":61,"acceptedAnswer":71},"What is the difference between WHERE and HAVING clauses?",{"text":72,"@type":64},"WHERE filters rows before GROUP BY, while HAVING filters summarized groups after GROUP BY. Aggregate functions are not used directly in WHERE but can be used in HAVING.","https://schema.org",{"og:url":32,"og:type":75,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":77,"canonical":32},"index,follow",{"doc_id":79,"site_id":7},718161,1794854380,{"code":4,"msg":82,"data":83},"success",[84,88,92,95,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":85,"show_sort_weight":86,"slug":87},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":89,"show_sort_weight":90,"slug":91},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":93,"slug":94},70,"exam",{"id":96,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},5,"Comic",60,"comic",{"id":55,"doc_module":4,"doc_module_name":25,"category_name":101,"show_sort_weight":102,"slug":103},"Technology",50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":96,"slug":129},19,"General","general",{"code":4,"msg":82,"data":131},{"doc_id":79,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":33,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":139,"language":140,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":12,"update_tm":80,"read_time":144,"preview_page_count":96,"preview_urls":145},34359740700684,"https://ap-avatar.wpscdn.com/avatar/1f400023980c374ae676?_k=1777273430885731487","SQL INTERVIEW QUESTIONS AND ANSWERS  \n# SQL INTERVIEW\n\n## QUESTIONS&ANSWERS\n\n1 | P ag e  \nTopperworld.in  \nSQL INTERVIEW QUESTIONS AND ANSWERS  \n## MOST FREQUENTLY ASKED SQL INTERVIEW QUESTIONS\n\n1. What isthe difference between “Stored Procedure”and “Function”?  \n### 1. A procedure can have both input and output parameters, but a function can onlyhave input parameters.\n\n2. Inside a procedure we can use DML (INSERT/UPDATE/DELETE) statements. Butinside a function we can't use DML statements.  \n3. We can't utilize a Stored Procedure ina Select statement. But wecanusea functionina Select statement.  \n4. We canusea Try-Catch Block ina Stored Procedure but inside a function we can'tuse a Try-Catch block.  \n5. We can use transaction management ina procedure but we can't ina function.  \n6. We can't join a Stored Procedure but we can join functions.  \n7. Stored Procedures cannot be used in the SQL statements anywhere in theWHERE/HAVING/SELECT section. But wecanusea function anywhere.  \n8. A procedure can return 0 or n values (max 1024) . But afunction can return only 1value that is mandatory.  \n9. A procedure can't be called from a function but we cancalla function from aprocedure.  \n### 2.What is difference between “Clustered Index” and “Non Clustered Index”?\n\n1. A Clustered Index physically stores the data of the table in the order of the keysvalues andthe data is resorted everytime whenever anew value is inserted oravalue is updated in the column on which itis defined, whereas anon-clustered indexcreates a separate list of key values (or creates atable of pointers) that pointstowards the location of the data in the data pages.  \n2. A Clustered Index requires no separate storage than the table storage. It forces therows tobe stored sorted on the index key whereas anon-clustered index requiresseparate storage than the table storage to store the index information.  \n3. Atable with a Clustered Index is called a Clustered Table. Its rows are stored in a B -Tree structure sorted whereas atable without any clustered indexes is called anon -clustered table. Its rows are stored ina heap structure unsorted.  \n4. The default index is created as part of the primary key column asa Clustered Index.  \n5. Ina Clustered Index, the leaf node contains the actual data whereas ina non -clustered index, the leaf node contains the pointer to the data rowsofthe table.  \n6. A Clustered Index always hasan Index Id of 1 whereas non-clustered indexes haveIndex Ids > 1.  \n7. A Table can have only 1 Clustered Index whereas prior to SQL Server 2008 only 249non-clustered indexes can be created. With SQL Server 2008 and above 999 non -clustered indexes can be created.  \n8. A Primary Key constraint creates a Clustered Index by default whereas A UniqueKey constraint creates anon-clustered index by default.  \n2 | P ag e  \nTopperworld.in  \nSQL INTERVIEW QUESTIONS AND ANSWERS  \n3.What isthe difference between the “DELETE” and “TRUNCATE” commands?  \n1. The DELETE command is used to remove rows from atable basedona WHEREcondition whereas TRUNCATE removes all rows from atable.  \n2. Sowecanusea where clause with DELETE to filter and delete specific recordswhereas we cannot use a Where clause with TRUNCATE.  \n3. DELETE is executed using a row lock, each row in the table is locked for deletionwhereas TRUNCATE is executed using atable lock andthe entire table is locked forremoval of all records.  \n4. DELETE isa DML command whereas TRUNCATE isa DDL command.  \n5. DELETE retains the identity of the column value whereas in TRUNCATE, the Identifycolumn is reset to its seed value if the table contains any identity column.  \n6. To use Delete you need DELETE permission on the table whereas to use Truncate onatable you need at least ALTER permission on the table.  \n7. DELETE uses more transaction space than the TRUNCATE statement whereasTruncate uses less transaction space than DELETE statement.  \n8. DELETE can be used with indexed views whereas TRUNCATE cannot be used withindexed view","cbCaicIg3UoXtl6X","https://ap.wps.com/l/cbCaicIg3UoXtl6X","pdf",1430073,47,"English","# SQL INTERVIEW\n## Most Frequently Asked SQL Interview Questions","[{\"question\":\"What is the difference between a Stored Procedure and a Function?\",\"answer\":\"A procedure can take input and output parameters, and it can use DML in its body. A function cannot use DML, and it can be used inside a SELECT statement, unlike a stored procedure.\"},{\"question\":\"What is the difference between DELETE and TRUNCATE?\",\"answer\":\"DELETE removes selected rows based on a WHERE condition and is logged row-by-row with row locks. TRUNCATE removes all rows using table-level locks, is a DDL operation, and deallocates data pages rather than deleting row-by-row.\"},{\"question\":\"What is the difference between WHERE and HAVING clauses?\",\"answer\":\"WHERE filters rows before GROUP BY, while HAVING filters summarized groups after GROUP BY. Aggregate functions are not used directly in WHERE but can be used in HAVING.\"}]","SQL Interview Questions and Answers - Most Frequently Asked SQL Interview Questions | PDF",118,[146,150,154,158,162],{"page_no":22,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/63b70a939e9a069a49bef337a78d37f1.webp",983,1272,{"page_no":26,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/f484444731f0d3fbd4be10c6c4fd7a5e.webp",982,1270,{"page_no":30,"url":155,"width":156,"height":157},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/681c4de9f1ed06847998ffb2ed833e14.webp",981,1269,{"page_no":33,"url":159,"width":160,"height":161},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/47518de9b822123ddbf8d8feeaadb13d.webp",980,1268,{"page_no":96,"url":163,"width":164,"height":165},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/507f7194ca175c74f04aa92d720fe298.webp",979,1267,{"list":167,"token":11},[168,175,182,188,194,200,206,213,219,225],{"doc_id":169,"doc_title":170,"file_type":137,"home_preview_img_url":171,"slug":172,"view_count":173,"category_name":29,"create_tm":174},391529,"Top Accenture SQL Interview Questions and Answers - read online free","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917385245/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796202779&Signature=Vrfc0kgOEdnQbzKPM7rwdx%2Bx6l4%3D","top-accenture-sql-interview-questions-and-answers-read-online-free",16,1790353902,{"doc_id":176,"doc_title":177,"file_type":137,"home_preview_img_url":178,"slug":179,"view_count":180,"category_name":29,"create_tm":181},391746,"SQL TOP50 - Important Interview Questions & Answers","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917704632/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796202779&Signature=sSkd7z0zk7caL71Onvni3hCnFsg%3D","sql-top50-important-interview-questions-answers",15,1790358325,{"doc_id":183,"doc_title":184,"file_type":137,"home_preview_img_url":185,"slug":186,"view_count":33,"category_name":29,"create_tm":187},718158,"WORKSHEET WITH SOLUTION SQL - SQL - Answers","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230019199677/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796202779&Signature=dtc7%2F%2F5JgTehufF5Q46MN1Ky9oM%3D","worksheet-with-solution-sql-sql-answers",1794854371,{"doc_id":189,"doc_title":190,"file_type":137,"home_preview_img_url":191,"slug":192,"view_count":127,"category_name":29,"create_tm":193},391282,"TCS NQT Interview Questions for Freshers - Technical Interview Questions","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917375092/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796202779&Signature=Lxii5u6WgAS4ZAby9uLfUgBgZZs%3D","tcs-nqt-interview-questions-for-freshers-technical-interview-questions",1790351065,{"doc_id":195,"doc_title":196,"file_type":137,"home_preview_img_url":197,"slug":198,"view_count":173,"category_name":29,"create_tm":199},391748,"SQL Interview - Questions and Answers","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917405671/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796202779&Signature=3ZTR9M07n6OnyVTdoDd7SpK9MoU%3D","sql-interview-questions-and-answers",1790358420,{"doc_id":201,"doc_title":202,"file_type":137,"home_preview_img_url":203,"slug":204,"view_count":96,"category_name":29,"create_tm":205},718156,"800-SQL-Server-questions - SQL Server Interview Questions Answers (More Than 800)","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230018609964/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796202779&Signature=lYBHnElGaaaaJyGVnMmXd6hrapg%3D","800-sql-server-questions-sql-server-interview-questions-answers-more-than-800",1794854364,{"doc_id":207,"doc_title":208,"file_type":137,"home_preview_img_url":209,"slug":210,"view_count":211,"category_name":29,"create_tm":212},391248,"HCL Interview Questions for Freshers","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917655514/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796202779&Signature=D%2F2bBqNt2kKbTIvdlqYNqyIVQyI%3D","hcl-interview-questions-for-freshers",27,1790350372,{"doc_id":214,"doc_title":215,"file_type":137,"home_preview_img_url":216,"slug":217,"view_count":117,"category_name":29,"create_tm":218},391776,"Wipro Technical Interview Questions - Memory Management, OS, SQL & Programming Basics","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917406217/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796202779&Signature=wdttvcZW6uATLVeE4919eFb4Ffo%3D","wipro-technical-interview-questions-memory-management-os-sql-programming-basics",1790358632,{"doc_id":220,"doc_title":221,"file_type":137,"home_preview_img_url":222,"slug":223,"view_count":173,"category_name":29,"create_tm":224},391791,"HTML Interview Questions and Answers for Freshers","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917706275/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796202779&Signature=hIYWxnp7vdWO3a6hlBebc79%2Bl1I%3D","html-interview-questions-and-answers-for-freshers",1790358751,{"doc_id":226,"doc_title":227,"file_type":137,"home_preview_img_url":228,"slug":229,"view_count":230,"category_name":29,"create_tm":231},391110,"Wipro technical and HR interview questions - Prepare well for recruitment","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917645917/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796202779&Signature=7hQG5R6%2Fq3jenkYXw8mEDgyyKqI%3D","wipro-technical-and-hr-interview-questions-prepare-well-for-recruitment",18,1790349347]