{"id":6166,"date":"2021-05-11T05:12:12","date_gmt":"2021-05-11T05:12:12","guid":{"rendered":"https:\/\/www.scmgalaxy.com\/tutorials\/?p=6166"},"modified":"2021-05-11T05:26:06","modified_gmt":"2021-05-11T05:26:06","slug":"dbms-interview-qa-part-2","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/dbms-interview-qa-part-2\/","title":{"rendered":"DBMS Interview Q&#038;A Part- 2"},"content":{"rendered":"\n<h5 class=\"wp-block-heading\">Q1. Can you create a table without using create command ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> Yes, we can create table with the help of SELECT INTO statement. It<br>copies content of one table to another table. However, there should be<br>at least one table from where we can copy content.<br>Example :  Copying all columns : select * into new_table from old_table where<br>condition<br>Copying specific column : select col1,col2 into new_table from old_table<br>where condition<br>Creating new empty table : select * into new_table from old_table where 1<br>= 0<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q2. What is Denormalization ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> It is the reverse process of Normalization. It is the process of trying to<br>improve the readability of the database by grouping data. Denormalization<br>is also used for speeding up the performance.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q3. What are Joins ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> Join clause are used to combine rows from two or more tables,<br>depending upon the columns between them.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q4. What are the different types of Joins ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> Different types of Joins are :<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>INNER JOIN<\/strong> : It returns all records that are common in both tables.<\/li><li><strong>LEFT OUTER JOIN<\/strong> : It returns all records from the left table, and matched records from right table<\/li><li><strong>RIGHT OUTER JOIN<\/strong> : It returns all records from the right table, and matched records from left table.<\/li><li><strong>FULL OUTER JOIN<\/strong> : It returns all records when there is a match in either left or right table.<\/li><\/ol>\n\n\n\n<h5 class=\"wp-block-heading\">Q5. Explain Transaction ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A. <\/strong>Transaction refers to the collection of multiple statements, that are<br>responsible for transferring a database from one consistent state to another<br>consistent state.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q6. Explain the role of views in database ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">A.View refers to the virtual table. We can create view using create view<br>statement.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nCREATE VIEW as Select col1\nFROM table1\nwhere CONDITION;\n<\/pre><\/div>\n\n\n<h5 class=\"wp-block-heading\">Q7. Explain Trigger ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> Triggers are defined as special kind of stored programs, which are<br>automatically executed whenever a specific operation occurs in the<br>database server.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q8. What are Locks ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> Locking is the mechanism to protect data integrity and ensure data<br>consistency during transactions. Locks are the most common cause of<br>blocked processes. Stronger the Isolation level, more the chances of<br>blocking.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q9. Explain different types of Locks ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> Locks are broadly characterized into following types :<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shared Locks<\/strong> : These locks are acquired by readers during read<br>operations. In other words, these locks exist when two transactions are<br>granted read access. Data updation is not allowed until shared lock is<br>released.<br><strong>Exclusive Locks<\/strong> : In exclusive lock, data items can be both read as well<br>as written by the transaction. In Exclusive lock, multiple transactions do not<br>modify the same data simultaneously.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q10. What is Super Key ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> An attribute or set of attributes that uniqueness in database is refered to<br>as Super key. It is the superset of Candidate key.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q11. What is Candidate Key ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> A minimal set of attribute\/attributes that can be used to uniquely identify<br>a single row in a given relation is refered to as Candidate key.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q12. Explain Primary Key ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> DB Designer selects one of the candidate key as primary key for a<br>relation for the purpose of identification of a tuple uniquely. It is identified<br>during table creation.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q13. What is Composite Key ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> If a primary key has more than one attribute, then it is referred to as<br>Composite key.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q14. Explain Foreign Key ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> A set of attribute\/attributes that is used to establish and enforce a link<br>between data in two or more relations.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q15. Can a table have more than one primary key ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> No.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q16. Can We Have NULL Value in Primary Key?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> No.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q17. What are cursors ?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A.<\/strong> A cursor is a temporary work area created in system memory when a<br>SQL statement is executed. A cursor can hold more than one row, but can<br>process only one row at a time.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Q18.<strong>What are the differences between Hash join, Merge join and Nested loops?<\/strong><\/h5>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>Hash join<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Merge join<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><strong>Nested loops<\/strong><\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">The hash join is used when you have to join large tables.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Merge join is used when projections of the joined tables are sorted on the join columns.<\/td><td class=\"has-text-align-center\" data-align=\"center\">The nested loop consists of an outer loop and an inner loop.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\">Q19. <strong>What do you understand by\u00a0Proactive, Retroactive and Simultaneous Update<\/strong> ?<\/h5>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>Proactive Update:<\/strong>\u00a0These updates are applied to the database before it becomes effective in the real-world environment.<\/li><li><strong>Retroactive Update:<\/strong>\u00a0These retroactive updates are applied to a database after it becomes effective in the real-world environment.<\/li><li><strong>Simultaneous Update:<\/strong>\u00a0These updates are applied to the database at the same instance of time as it becomes effective in a real-world environment.<\/li><\/ol>\n\n\n\n<h5 class=\"wp-block-heading\">Q20.<strong>What do you understand by Data Independence?<\/strong><\/h5>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A. <\/strong>When you say an application has data independence, it implies that the application is independent of the storage structure and data access strategies of data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Q1. Can you create a table without using create command ? A. Yes, we can create table with the help [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[72],"tags":[5282,5284,4594,766,5285,5287,5288,482,5286,818],"class_list":["post-6166","post","type-post","status-publish","format-standard","hentry","category-database","tag-dbms","tag-denormalization","tag-engineers","tag-interview","tag-joins","tag-locks","tag-primary-key","tag-questions","tag-transaction","tag-trigger"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>DBMS Interview Q&amp;A Part- 2 - scmGalaxy<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.scmgalaxy.com\/tutorials\/dbms-interview-qa-part-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DBMS Interview Q&amp;A Part- 2 - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"Q1. Can you create a table without using create command ? A. Yes, we can create table with the help [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/dbms-interview-qa-part-2\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-11T05:12:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-11T05:26:06+00:00\" \/>\n<meta name=\"author\" content=\"Chandan Kumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Chandan Kumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/dbms-interview-qa-part-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/dbms-interview-qa-part-2\\\/\"},\"author\":{\"name\":\"Chandan Kumar\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/0990c0a2b3e841b474db853d83993e98\"},\"headline\":\"DBMS Interview Q&#038;A Part- 2\",\"datePublished\":\"2021-05-11T05:12:12+00:00\",\"dateModified\":\"2021-05-11T05:26:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/dbms-interview-qa-part-2\\\/\"},\"wordCount\":758,\"keywords\":[\"dbms\",\"Denormalization\",\"Engineers\",\"Interview\",\"Joins\",\"Locks\",\"Primary Key\",\"Questions\",\"Transaction\",\"Trigger\"],\"articleSection\":[\"Database\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/dbms-interview-qa-part-2\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/dbms-interview-qa-part-2\\\/\",\"name\":\"DBMS Interview Q&A Part- 2 - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"datePublished\":\"2021-05-11T05:12:12+00:00\",\"dateModified\":\"2021-05-11T05:26:06+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/0990c0a2b3e841b474db853d83993e98\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/dbms-interview-qa-part-2\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/dbms-interview-qa-part-2\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/dbms-interview-qa-part-2\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DBMS Interview Q&#038;A Part- 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/0990c0a2b3e841b474db853d83993e98\",\"name\":\"Chandan Kumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/74c343a5ceb90ca898e3d70936f38c44a8ce15becca310570da3b614131b436f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/74c343a5ceb90ca898e3d70936f38c44a8ce15becca310570da3b614131b436f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/74c343a5ceb90ca898e3d70936f38c44a8ce15becca310570da3b614131b436f?s=96&d=mm&r=g\",\"caption\":\"Chandan Kumar\"},\"description\":\"Be a Full Stack Developer and eager to learn new Technology. Knowledge: CSS, Bootstrap, Javascript, PHP, WordPress, Joomla, Moodle, Laravel, AJAX, Jquery, Java, Dart, Flutter, Photoshop, CorelDraw, Pagemaker &amp; Office Package\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/chandan\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DBMS Interview Q&A Part- 2 - scmGalaxy","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.scmgalaxy.com\/tutorials\/dbms-interview-qa-part-2\/","og_locale":"en_US","og_type":"article","og_title":"DBMS Interview Q&A Part- 2 - scmGalaxy","og_description":"Q1. Can you create a table without using create command ? A. Yes, we can create table with the help [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/dbms-interview-qa-part-2\/","og_site_name":"scmGalaxy","article_published_time":"2021-05-11T05:12:12+00:00","article_modified_time":"2021-05-11T05:26:06+00:00","author":"Chandan Kumar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Chandan Kumar","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/dbms-interview-qa-part-2\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/dbms-interview-qa-part-2\/"},"author":{"name":"Chandan Kumar","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/0990c0a2b3e841b474db853d83993e98"},"headline":"DBMS Interview Q&#038;A Part- 2","datePublished":"2021-05-11T05:12:12+00:00","dateModified":"2021-05-11T05:26:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/dbms-interview-qa-part-2\/"},"wordCount":758,"keywords":["dbms","Denormalization","Engineers","Interview","Joins","Locks","Primary Key","Questions","Transaction","Trigger"],"articleSection":["Database"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/dbms-interview-qa-part-2\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/dbms-interview-qa-part-2\/","name":"DBMS Interview Q&A Part- 2 - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"datePublished":"2021-05-11T05:12:12+00:00","dateModified":"2021-05-11T05:26:06+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/0990c0a2b3e841b474db853d83993e98"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/dbms-interview-qa-part-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/dbms-interview-qa-part-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/dbms-interview-qa-part-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"DBMS Interview Q&#038;A Part- 2"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/0990c0a2b3e841b474db853d83993e98","name":"Chandan Kumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/74c343a5ceb90ca898e3d70936f38c44a8ce15becca310570da3b614131b436f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/74c343a5ceb90ca898e3d70936f38c44a8ce15becca310570da3b614131b436f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/74c343a5ceb90ca898e3d70936f38c44a8ce15becca310570da3b614131b436f?s=96&d=mm&r=g","caption":"Chandan Kumar"},"description":"Be a Full Stack Developer and eager to learn new Technology. Knowledge: CSS, Bootstrap, Javascript, PHP, WordPress, Joomla, Moodle, Laravel, AJAX, Jquery, Java, Dart, Flutter, Photoshop, CorelDraw, Pagemaker &amp; Office Package","url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/chandan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/6166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=6166"}],"version-history":[{"count":4,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/6166\/revisions"}],"predecessor-version":[{"id":6170,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/6166\/revisions\/6170"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=6166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=6166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=6166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}