{"id":37330,"date":"2020-04-23T15:21:11","date_gmt":"2020-04-23T22:21:11","guid":{"rendered":"https:\/\/virtual-dba.com\/?p=37330"},"modified":"2021-02-10T18:11:21","modified_gmt":"2021-02-11T01:11:21","slug":"writing-sql-with-sql","status":"publish","type":"post","link":"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/","title":{"rendered":"Writing SQL with SQL"},"content":{"rendered":"\n<p>The Db2 RDBMS offers many great tools for getting things done. There are, however, times when tools are unavailable. This isn\u2019t a problem when you\u2019re performing a simple and discrete task. When the task has many iterations then like dropping triggers or granting privileges then running the commands manually can be tedious and time-consuming. For these occasions you can use SQL to write out the commands for you. Ember Crooks describes the basic methodology in her blog article <a href=\"https:\/\/datageek.blog\/en\/2012\/02\/06\/basic-scripting-tricks-for-db2-lu\/\" target=\"_blank\" rel=\"noreferrer noopener\"><em>Basic scripting tricks for DB2(LUW)<\/em><\/a>. My intention here is to provide those basics, explaining various functions, and offer additional insight for using this method. The process outlined here is intended for use with any version of Db2 on Linux\/Unix OS\u2019s.<\/p>\n\n\n\n<p><strong>The Basics of Writing SQL with SQL<\/strong><\/p>\n\n\n\n<p>The process for using SQL to write SQL involves running a select statement with an expression that combines text with data results from tables and redirects that output to a file for execution. The basics of this are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Use a basic select statement to create other SQL statements<\/li><li>Do not include \u2018db2\u2019 at the start of the expression since this is unnecessary<\/li><li>Use the &#8216;-x&#8217; CLP option to eliminate the column header and footer from the results<br>(details for Db2 CLP options can be found at this <a href=\"https:\/\/www.ibm.com\/support\/knowledgecenter\/SSEPGG_11.1.0\/com.ibm.db2.luw.admin.cmd.doc\/doc\/r0010410.html\" target=\"_blank\" rel=\"noreferrer noopener\">knowledge center page<\/a>)<\/li><li>Wrap strings in single quotes, concatenating them with the table data using || (the CONCAT function)<\/li><li>Keep the SQL statement output clean using RTRIM<\/li><li>Be sure to include a terminating character<\/li><\/ul>\n\n\n\n<p>When creating statements with this method, care should be taken to properly handle special characters. The single quotation mark, or apostrophe, is one such case that bears specific consideration. If the apostrophe is part of the string, it will need to be escaped or else Db2 will interpret it as a delimiter for the string. To escape this character preface it with another apostrophe. The range of special characters for Db2 can be found in their <a href=\"https:\/\/www.ibm.com\/support\/knowledgecenter\/SSEPGG_11.1.0\/com.ibm.db2.luw.sql.ref.doc\/doc\/r0000718.html\" target=\"_blank\" rel=\"noreferrer noopener\">knowledge center <em>characters <\/em>page<\/a>.<\/p>\n\n\n\n<p><strong>Example<\/strong><\/p>\n\n\n\n<p>This example uses SQL to write the necessary statements for dropping triggers. Here we target all triggers but a where clause could also be added to restrict the triggers targeted for dropping.<\/p>\n\n\n<p><code>    db2 -x \"select 'drop trigger ' || trigname || ';' from syscat.triggers with ur\" &gt; trig_drops.sql<\/code><\/p>\n\n\n<p>Which will produce output similar to this:<\/p>\n\n\n<p><code>    drop trigger STAG0001;<br>\n    drop trigger STAG0002;<br>\n    drop trigger STAG0003;<br>\n    drop trigger STAG0007;<br>\n    drop trigger STAG0008;<br>\n<\/code><\/p>\n\n\n<p>The output from this statement can then be executed using the following command (be sure to include the &#8216;v&#8217; option or otherwise direct the output to a file so that you can see if any of the statements fail):<\/p>\n\n\n<p><code>db2 -tvf trig_drops.sql<\/code><\/p>\n\n\n<p><strong>Working with Distinct<\/strong><\/p>\n\n\n\n<p>This is great and works for the majority of use cases, but occasionally you need to do something more complex, or we need to keep our results restricted to unique values, like using the sysinstallobjects procedure for upgrading explain tables. Upgrading these tables after upgrading your Db2 version is important to maintain their functionality. You could search for all of the explain tables and then write and call the procedure for each schema manually, or you can use SQL to write the statements for you. Your first attempt might look something like this:<\/p>\n\n\n<p><code>db2 -x \"select 'call sysinstallobjects(''EXPLAIN'',''M'',''NULL'',''' || rtrim(tabschema) || ''');' from syscat.tables where tabname like 'EXPLAIN' and type='T' with ur\" &gt; explain.sql<\/code><\/p>\n\n\n<p>This statement will produce viable statements, but there will be a lot of redundancy as shown below:<\/p>\n\n\n<p><code>call sysinstallobjects('EXPLAIN','M','NULL','DB2INST1');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','DB2INST1');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','DB2INST1');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','DB2INST1');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','DB2INST1');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','DB2INST1');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','DB2INST1');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','DB2INST1');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','SYSIBM');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','SYSIBM');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','SYSIBM');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','SYSTOOLS');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','SYSTOOLS');<\/code><\/p>\n<p><code><br>\n<\/code><\/p>\n<p><code><\/code><\/p>\n\n\n<p>Your next attempt will be to write the statement leveraging the power of distinct to eliminate the duplicate entries:<\/p>\n\n\n<p><code>db2 -x \"select 'call sysinstallobjects(''EXPLAIN'',''M'',''NULL'',''' || distinct(rtrim(tabschema)) || ''');' from syscat.tables where tabname like 'EXPLAIN%' and type='T' with ur\" &gt; explain.sql   <\/code><\/p>\n\n\n<p>But this command will fail with the following error:<\/p>\n\n\n<p><code>    SQL0440N  No authorized routine named \"DISTINCT\" of type \"FUNCTION\" having<br>\n    compatible arguments was found.  SQLSTATE=42884<br>\n<\/code><\/p>\n\n\n<p>There are two options for making distinct work to produce the desired results. Both methods will work, however, the first is likely to be a better choice for most circumstances.<\/p>\n\n\n\n<p>METHOD 1:<\/p>\n\n\n\n<p>This first method would be more desirable for its simplicity and ease of use. To do so, simply place the distinct clause out in front of your selected criteria, wrapping the expression in parenthesis like so:<\/p>\n\n\n<p><code>    db2 -x \"select distinct('call sysinstallobjects(''EXPLAIN'',''M'',''NULL'',''' || rtrim(tabschema) || ''');') from syscat.tables where tabname like 'EXPLAIN' and type='T' with ur\" &gt; explain.sql<\/code><\/p>\n\n\n<p>this will produce the desired results like so:<\/p>\n\n\n<p><code>call sysinstallobjects('EXPLAIN','M','NULL','DB2INST1');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','SYSIBM');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','SYSTOOLS');<br>\n<\/code><\/p>\n\n\n<p>METHOD 2:<\/p>\n\n\n\n<p>This second method is more complex, and certainly wouldn\u2019t be necessary for our sample case, but in some circumstances the concept may be useful so I include it here. We can also get distinct to work using a &#8216;with&#8217; statement.<\/p>\n\n\n<p><code>db2 -x \"with temptable (schema) as (select distinct(tabschema) from syscat.tables where tabname like 'EXPLAIN' and type='T' with ur) select 'call sysinstallobjects(''EXPLAIN'',''M'',''NULL'',''' || rtrim(schema) || ''');' from temptable\" &gt; explain.sql<br>\n<\/code><\/p>\n\n\n<p>The output will be the same as method 1:<\/p>\n\n\n<p><code>call sysinstallobjects('EXPLAIN','M','NULL','DB2INST1');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','SYSIBM');<br>\ncall sysinstallobjects('EXPLAIN','M','NULL','SYSTOOLS');<br>\n<\/code><\/p>\n\n\n<p><strong>Piping the Statements<\/strong><\/p>\n\n\n\n<p>In our process thus far we&#8217;ve chosen to redirect the output to a file for later execution. For small result sets the intermediary file can be eliminated in lieu of piping the results for execution immediately. This is achieved by piping the select statement back into the Db2 CLP. Using our trigger example the complete statement would look like this:<\/p>\n\n\n<p><code>db2 -x \"select 'drop trigger ' || trigname || ';' from syscat.triggers with ur\" | db2 -tv<\/code><\/p>\n\n\n<p>The initial statement is exactly the same as before, but instead of redirecting the output to a file we pipe it back through Db2 for immediate execution. The drawback to this method is the system\u2019s pipe buffer size. If the results are too large for the buffer, the command will hang. The amount of space available to the pipe buffer is different from system to system and there is no standard way for checking the size.<\/p>\n\n\n\n<p>When using this method it is important to include the &#8216;x&#8217; option at the beginning. Excluding the &#8216;x&#8217; will cause the output header to be included with the first command which will cause it to fail.<\/p>\n\n\n\n<p><strong>Conclusion<\/strong><\/p>\n\n\n\n<p>Using SQL to create statements helps DBA&#8217;s perform tedious tasks easily. This method can be utilized for a variety of situations and circumstances beyond those suggested here. For instance, you can use this method to build a single SQL statement where the table queried has a huge number of columns or to write grant statements for setting up a group or role.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Db2 RDBMS offers many great tools for getting things done. There are, however, times when tools are unavailable. This isn\u2019t a problem when you\u2019re performing a simple and discrete task. When the task has many iterations then like dropping triggers or granting privileges then running the commands manually can be tedious and time-consuming. For [&hellip;]<\/p>\n","protected":false},"author":29,"featured_media":37332,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","content-type":"","footnotes":""},"categories":[4166,17],"tags":[4079,3890,4078],"class_list":["post-37330","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","category-db2","tag-db2-tricks","tag-sql","tag-statement-creation"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.1 (Yoast SEO v27.1.1) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Writing SQL with SQL<\/title>\n<meta name=\"description\" content=\"SQL provides amazing ways to get things done when other tools or applications may be lacking.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Writing SQL with SQL\" \/>\n<meta property=\"og:description\" content=\"SQL provides amazing ways to get things done when other tools or applications may be lacking.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/\" \/>\n<meta property=\"og:site_name\" content=\"Virtual-DBA Remote DBA Services &amp; Support - Certified Database Experts\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-23T22:21:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-11T01:11:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/virtual-dba.com\/media\/Writing-SQL-with-SQL.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"557\" \/>\n\t<meta property=\"og:image:height\" content=\"291\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Marc Petros\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@virtual_dba\" \/>\n<meta name=\"twitter:site\" content=\"@virtual_dba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Marc Petros\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/\"},\"author\":{\"name\":\"Marc Petros\",\"@id\":\"https:\/\/virtual-dba.com\/#\/schema\/person\/df5834301b0edec142d0a2da82460c46\"},\"headline\":\"Writing SQL with SQL\",\"datePublished\":\"2020-04-23T22:21:11+00:00\",\"dateModified\":\"2021-02-11T01:11:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/\"},\"wordCount\":920,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/virtual-dba.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/virtual-dba.com\/wp-content\/uploads\/Writing-SQL-with-SQL.jpg\",\"keywords\":[\"Db2 tricks\",\"sql\",\"statement creation\"],\"articleSection\":[\"Blog\",\"Db2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/\",\"url\":\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/\",\"name\":\"Writing SQL with SQL\",\"isPartOf\":{\"@id\":\"https:\/\/virtual-dba.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/virtual-dba.com\/wp-content\/uploads\/Writing-SQL-with-SQL.jpg\",\"datePublished\":\"2020-04-23T22:21:11+00:00\",\"dateModified\":\"2021-02-11T01:11:21+00:00\",\"description\":\"SQL provides amazing ways to get things done when other tools or applications may be lacking.\",\"breadcrumb\":{\"@id\":\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#primaryimage\",\"url\":\"https:\/\/virtual-dba.com\/wp-content\/uploads\/Writing-SQL-with-SQL.jpg\",\"contentUrl\":\"https:\/\/virtual-dba.com\/wp-content\/uploads\/Writing-SQL-with-SQL.jpg\",\"width\":557,\"height\":291,\"caption\":\"Writing SQL with SQL\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/virtual-dba.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Writing SQL with SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/virtual-dba.com\/#website\",\"url\":\"https:\/\/virtual-dba.com\/\",\"name\":\"Virtual-DBA Remote DBA Services &amp; Support - Certified Database Experts\",\"description\":\"Remote Database Administration\",\"publisher\":{\"@id\":\"https:\/\/virtual-dba.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/virtual-dba.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/virtual-dba.com\/#organization\",\"name\":\"Virtual-DBA: Remote DBA | Remote Database Administration\",\"alternateName\":\"Virtual-DBA powered by XTIVIA\",\"url\":\"https:\/\/virtual-dba.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtual-dba.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/virtual-dba.com\/wp-content\/uploads\/V-DBA-Database-Services-and-Support-Featured-Logo.jpg\",\"contentUrl\":\"https:\/\/virtual-dba.com\/wp-content\/uploads\/V-DBA-Database-Services-and-Support-Featured-Logo.jpg\",\"width\":557,\"height\":291,\"caption\":\"Virtual-DBA: Remote DBA | Remote Database Administration\"},\"image\":{\"@id\":\"https:\/\/virtual-dba.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/virtual_dba\",\"https:\/\/www.linkedin.com\/showcase\/36220649\/\",\"https:\/\/www.youtube.com\/channel\/UCx3AIeUQ2ziTLKZSJDZ-SEg\"],\"description\":\"Eliminate database downtime and spiraling costs with XTIVIA\u2019s Virtual-DBA. In today\u2019s always-on business world, gaps in 24x7 on-call DBA support, neglected maintenance and security, or a stretched team struggling with overwhelming workloads can lead to costly disruptions and threaten business continuity. XTIVIA\u2019s Virtual-DBA provides the immediate, expert database administration you need, exactly when you need it, ensuring optimal performance, ironclad security, and significant cost savings without the burden of expanding your in-house team. The goal of Virtual-DBA is to provide a cost-effective solution for organizations seeking to optimize the security, management, maintenance, availability, and performance of their critical business systems, whether self-managed or cloud-managed (e.g., AWS RDS, Azure SQL Database). We accomplish this through a comprehensive remote DBA service offering designed specifically to meet the Oracle\u00ae, DB2\u00ae, Informix\u00ae, MySQL\u2122, PostgreSQL\u00ae, MongoDB\u00ae, MariaDB, and Microsoft SQL Server\u00ae, CockroachDB, Databricks, AWS, and Azure needs of our clients.\",\"email\":\"info@xtivia.com\",\"telephone\":\"8886853101\",\"legalName\":\"XTIVIA, Inc\",\"foundingDate\":\"1992-05-01\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"201\",\"maxValue\":\"500\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/virtual-dba.com\/#\/schema\/person\/df5834301b0edec142d0a2da82460c46\",\"name\":\"Marc Petros\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtual-dba.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9644ca5003abd7bc6f6f177a2e4ec7d295dad5c97e8cdddb9190d2c58f2c42cd?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9644ca5003abd7bc6f6f177a2e4ec7d295dad5c97e8cdddb9190d2c58f2c42cd?s=96&d=mm&r=g\",\"caption\":\"Marc Petros\"},\"url\":\"https:\/\/virtual-dba.com\/author\/marc-petros\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Writing SQL with SQL","description":"SQL provides amazing ways to get things done when other tools or applications may be lacking.","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:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/","og_locale":"en_US","og_type":"article","og_title":"Writing SQL with SQL","og_description":"SQL provides amazing ways to get things done when other tools or applications may be lacking.","og_url":"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/","og_site_name":"Virtual-DBA Remote DBA Services &amp; Support - Certified Database Experts","article_published_time":"2020-04-23T22:21:11+00:00","article_modified_time":"2021-02-11T01:11:21+00:00","og_image":[{"width":557,"height":291,"url":"https:\/\/virtual-dba.com\/media\/Writing-SQL-with-SQL.jpg","type":"image\/jpeg"}],"author":"Marc Petros","twitter_card":"summary_large_image","twitter_creator":"@virtual_dba","twitter_site":"@virtual_dba","twitter_misc":{"Written by":"Marc Petros","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#article","isPartOf":{"@id":"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/"},"author":{"name":"Marc Petros","@id":"https:\/\/virtual-dba.com\/#\/schema\/person\/df5834301b0edec142d0a2da82460c46"},"headline":"Writing SQL with SQL","datePublished":"2020-04-23T22:21:11+00:00","dateModified":"2021-02-11T01:11:21+00:00","mainEntityOfPage":{"@id":"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/"},"wordCount":920,"commentCount":0,"publisher":{"@id":"https:\/\/virtual-dba.com\/#organization"},"image":{"@id":"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/virtual-dba.com\/wp-content\/uploads\/Writing-SQL-with-SQL.jpg","keywords":["Db2 tricks","sql","statement creation"],"articleSection":["Blog","Db2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/","url":"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/","name":"Writing SQL with SQL","isPartOf":{"@id":"https:\/\/virtual-dba.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#primaryimage"},"image":{"@id":"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/virtual-dba.com\/wp-content\/uploads\/Writing-SQL-with-SQL.jpg","datePublished":"2020-04-23T22:21:11+00:00","dateModified":"2021-02-11T01:11:21+00:00","description":"SQL provides amazing ways to get things done when other tools or applications may be lacking.","breadcrumb":{"@id":"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#primaryimage","url":"https:\/\/virtual-dba.com\/wp-content\/uploads\/Writing-SQL-with-SQL.jpg","contentUrl":"https:\/\/virtual-dba.com\/wp-content\/uploads\/Writing-SQL-with-SQL.jpg","width":557,"height":291,"caption":"Writing SQL with SQL"},{"@type":"BreadcrumbList","@id":"https:\/\/virtual-dba.com\/blog\/writing-sql-with-sql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/virtual-dba.com\/"},{"@type":"ListItem","position":2,"name":"Writing SQL with SQL"}]},{"@type":"WebSite","@id":"https:\/\/virtual-dba.com\/#website","url":"https:\/\/virtual-dba.com\/","name":"Virtual-DBA Remote DBA Services &amp; Support - Certified Database Experts","description":"Remote Database Administration","publisher":{"@id":"https:\/\/virtual-dba.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/virtual-dba.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/virtual-dba.com\/#organization","name":"Virtual-DBA: Remote DBA | Remote Database Administration","alternateName":"Virtual-DBA powered by XTIVIA","url":"https:\/\/virtual-dba.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtual-dba.com\/#\/schema\/logo\/image\/","url":"https:\/\/virtual-dba.com\/wp-content\/uploads\/V-DBA-Database-Services-and-Support-Featured-Logo.jpg","contentUrl":"https:\/\/virtual-dba.com\/wp-content\/uploads\/V-DBA-Database-Services-and-Support-Featured-Logo.jpg","width":557,"height":291,"caption":"Virtual-DBA: Remote DBA | Remote Database Administration"},"image":{"@id":"https:\/\/virtual-dba.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/virtual_dba","https:\/\/www.linkedin.com\/showcase\/36220649\/","https:\/\/www.youtube.com\/channel\/UCx3AIeUQ2ziTLKZSJDZ-SEg"],"description":"Eliminate database downtime and spiraling costs with XTIVIA\u2019s Virtual-DBA. In today\u2019s always-on business world, gaps in 24x7 on-call DBA support, neglected maintenance and security, or a stretched team struggling with overwhelming workloads can lead to costly disruptions and threaten business continuity. XTIVIA\u2019s Virtual-DBA provides the immediate, expert database administration you need, exactly when you need it, ensuring optimal performance, ironclad security, and significant cost savings without the burden of expanding your in-house team. The goal of Virtual-DBA is to provide a cost-effective solution for organizations seeking to optimize the security, management, maintenance, availability, and performance of their critical business systems, whether self-managed or cloud-managed (e.g., AWS RDS, Azure SQL Database). We accomplish this through a comprehensive remote DBA service offering designed specifically to meet the Oracle\u00ae, DB2\u00ae, Informix\u00ae, MySQL\u2122, PostgreSQL\u00ae, MongoDB\u00ae, MariaDB, and Microsoft SQL Server\u00ae, CockroachDB, Databricks, AWS, and Azure needs of our clients.","email":"info@xtivia.com","telephone":"8886853101","legalName":"XTIVIA, Inc","foundingDate":"1992-05-01","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"201","maxValue":"500"}},{"@type":"Person","@id":"https:\/\/virtual-dba.com\/#\/schema\/person\/df5834301b0edec142d0a2da82460c46","name":"Marc Petros","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtual-dba.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9644ca5003abd7bc6f6f177a2e4ec7d295dad5c97e8cdddb9190d2c58f2c42cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9644ca5003abd7bc6f6f177a2e4ec7d295dad5c97e8cdddb9190d2c58f2c42cd?s=96&d=mm&r=g","caption":"Marc Petros"},"url":"https:\/\/virtual-dba.com\/author\/marc-petros\/"}]}},"_links":{"self":[{"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/posts\/37330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/comments?post=37330"}],"version-history":[{"count":0,"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/posts\/37330\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/media\/37332"}],"wp:attachment":[{"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/media?parent=37330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/categories?post=37330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/tags?post=37330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}