<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kate Naylor</title>
    <description>The latest articles on DEV Community by Kate Naylor (@katenaylo).</description>
    <link>https://dev.to/katenaylo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F338375%2F838756f6-a4ac-4461-904c-555933aa1ed4.jpg</url>
      <title>DEV Community: Kate Naylor</title>
      <link>https://dev.to/katenaylo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/katenaylo"/>
    <language>en</language>
    <item>
      <title>Tips and tricks for SQL Server database (table) design?</title>
      <dc:creator>Kate Naylor</dc:creator>
      <pubDate>Fri, 15 May 2020 15:38:16 +0000</pubDate>
      <link>https://dev.to/katenaylo/tips-and-tricks-for-sql-server-database-table-design-2kb0</link>
      <guid>https://dev.to/katenaylo/tips-and-tricks-for-sql-server-database-table-design-2kb0</guid>
      <description>&lt;p&gt;Here are eight key database design rules, which are aimed to make your life easier. As it turns out, we often forget about painfully obvious things, so being prudent and wise stands above all rules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#1: Figure out the nature of the application: OLTP or OLAP&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you start your database design the first thing to analyze is the nature of the application you are designing for, is it Transactional (OLTP) or Analytical (OLAP). If you think CRUD i.e., creating, reading, updating, and deleting records are more prominent then go for a normalized table design, else create a flat denormalized database structure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#2: Break your data in to logical pieces&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You probably will need to apply this rule if your queries are using too many string parsing functions like substring, charindex, etc. Sometimes it is better to break fields into further logical pieces so that clean and optimal queries could be written.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p2u-qdkR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/agaeljgehhxa50pcl0sv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p2u-qdkR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/agaeljgehhxa50pcl0sv.png" alt="Break your data in to logical pieces"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#3: Do not get overdosed with breaking your data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you think about decomposing, give a pause and ask yourself, is it needed? For example, here’s the base of phone numbers. It’s rare that you will operate on ISD codes separately until your application demands it. So it would be a wise decision to just leave it as it can lead to more complications.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OsPcBTZI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zttp51l6stsj9uzv14bu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OsPcBTZI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zttp51l6stsj9uzv14bu.png" alt="Do not get overdosed with breaking your data"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#4: Avoid non-uniform data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Focus and refactor duplicate data. For instance, in the below diagram, you can see “5th Class” and “Fifth class” means the same. If you ever want to derive a report, they would show them as different entities, which is very confusing.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NPa7huBq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2vc06lexiuug5ofoglvh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NPa7huBq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2vc06lexiuug5ofoglvh.png" alt="Avoid non-uniform data"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#5: Avoid repeating groups&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the examples of repeating groups is explained in the below diagram.These kinds of columns which have data stuffed with separators need special attention and a better approach would be to move those fields to a different table and link them with keys for better management.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xi--jRwx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1m3fa5pecw5bwtw44cva.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xi--jRwx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1m3fa5pecw5bwtw44cva.png" alt="Avoid repeating groups"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#6: Choose derived columns preciously&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you are working on OLTP applications, getting rid of derived columns would be a good thought, unless there is some pressing reason for performance. In the case of OLAP where we do a lot of summations, calculations, these kinds of fields are necessary to gain performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#7: Centralize name value table design&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Name and value tables means it has key and some data associated with the key. For instance in the below figure you can see we have a currency table and a country table. If you watch the data closely they actually only have a key and value. For such kinds of tables, creating a central table and differentiating the data by using a type field makes more sense.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hV883Mbv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0b5a8xdlox029h1os0j4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hV883Mbv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0b5a8xdlox029h1os0j4.png" alt="Centralize name value table design"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#8: Do not be hard on avoiding redundancy, if performance is the key&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Do not make it a strict rule that you will always avoid redundancy. If there is a pressing need for performance think about de-normalization. In normalization, you need to make joins with many tables and in denormalization, the joins reduce and thus increase performance.&lt;/p&gt;

&lt;p&gt;As a bonus, I would recommend using &lt;a href="https://www.devart.com/dbforge/mysql/studio/"&gt;dbForge Studio&lt;/a&gt;. The solution will help you to avoid a whole bunch of mistakes while developing and managing databases. The following features will be especially useful:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1) Database Diagram&lt;/strong&gt; which shows the structure of an already created database. It often helps to decide whether tables and the relationships between them have to be redesigned;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) Visual Table Editor&lt;/strong&gt; provides convenient editing, filtering, sorting, copying of randomly selected cells, quick data export to INSERT query and many more;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) Data Editor&lt;/strong&gt; to view data, edit, and roll back changes, if necessary;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4) Source Control&lt;/strong&gt; to make controlled changes to the database during teamwork with the ability to view the history of changes (including revision ID, date, author and comments);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5) Schema Compare&lt;/strong&gt; to compare the developed and live versions of the database and understand what differences they have;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6) Query Profiler&lt;/strong&gt; allows comparing the performance of modified queries with current ones.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>sqlserver</category>
      <category>database</category>
      <category>crud</category>
    </item>
    <item>
      <title>Quick Check of SQL Table Contents With Data Visualizers</title>
      <dc:creator>Kate Naylor</dc:creator>
      <pubDate>Thu, 07 May 2020 15:30:28 +0000</pubDate>
      <link>https://dev.to/katenaylo/quick-check-of-sql-table-contents-with-data-visualizers-5ekb</link>
      <guid>https://dev.to/katenaylo/quick-check-of-sql-table-contents-with-data-visualizers-5ekb</guid>
      <description>&lt;p&gt;Visualize your SQL data to facilitate understanding and decision making with the &lt;strong&gt;Data Visualizers&lt;/strong&gt; feature of SQL Complete. On many occasions, developers and DBAs need to quickly check the table contents and getting data in a readable format without much effort becomes a matter of importance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.devart.com/dbforge/sql/sqlcomplete/"&gt;SQL Complete&lt;/a&gt; users can benefit from the opportunity to view the cell contents in the required format right in the Results grid whenever necessary. The tool takes the pain out of checking and analyzing tables with multi-format data.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Data visualizers&lt;/strong&gt; feature that is tailored to suit the needs of the most demanding SQL developers allows viewing data in 9 common data formats: Hexadecimal, Text, XML, HTML, Rich Text, PDF, JSON, Image, and Spatial. To start working with Data Visualizers, you should just output the required data to Results Grid and then switch to Data Viewer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MxqAfRs3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6q70dvw1ly3weczf7ew3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MxqAfRs3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6q70dvw1ly3weczf7ew3.png" alt="Data visualizers"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Image view
&lt;/h1&gt;

&lt;p&gt;The Image View option allows viewing database image contents right in the Results Grid which significantly saves your time and efforts. To enable the Image View, click the corresponding icon on the toolbar.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--67ME5lzx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9omv5fwo7nzt0z91pb1z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--67ME5lzx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9omv5fwo7nzt0z91pb1z.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Viewing data in the hexadecimal format
&lt;/h1&gt;

&lt;p&gt;In case you need to view the cell values in the hexadecimal data format, click the Hexadecimal View button in the Data Viewer and Editor toolbar and enjoy the quick result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rP87NMaE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bf265g5k9a1wmcn9u1xl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rP87NMaE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bf265g5k9a1wmcn9u1xl.png" alt="hexadecimal format"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Viewing data in the Text format
&lt;/h1&gt;

&lt;p&gt;To display the table data in the Text format, use the Text View option. It might be very helpful when working with tables that contain long descriptions and text data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RuKVrSse--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dnb9m3bavuw2cfiap8pl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RuKVrSse--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dnb9m3bavuw2cfiap8pl.png" alt="Text format"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Viewing data in the XML format
&lt;/h1&gt;

&lt;p&gt;XML View is designed to show the cell contents in a popular XML format. Just click the button and see the result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jTuRIvUk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sjna3g66jnymurrzvxst.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jTuRIvUk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sjna3g66jnymurrzvxst.png" alt="XML format"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Viewing data in the HTML format
&lt;/h1&gt;

&lt;p&gt;Switching to the HTML View will display the cell contents in the HTML format in a flash.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_ImTV715--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0hxkxoy50391juf3o701.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_ImTV715--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0hxkxoy50391juf3o701.png" alt="HTML format"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Viewing data in the Rich Text format
&lt;/h1&gt;

&lt;p&gt;The Rich Text View allows viewing contents in the Rich Text format with one click.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bi7S2hxi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tm7s3iwnj7x5bcrwzahy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bi7S2hxi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tm7s3iwnj7x5bcrwzahy.png" alt="Rich Text format"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Viewing data in the PDF format
&lt;/h1&gt;

&lt;p&gt;With the help of Data Viewer, you can quickly view a PDF document just by selecting the PDF View option and then positioning the mouse pointer over the value in the grid.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Kgioqn4w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kxg57aljh9g6c3zglsir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Kgioqn4w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kxg57aljh9g6c3zglsir.png" alt="PDF format"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Viewing data in the JSON format
&lt;/h1&gt;

&lt;p&gt;To view the data in the JSON format, click the JSON View button on the Data Viewer and Editor toolbar.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PeGBHnzm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/52n299f9xr7m6mv9p5av.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PeGBHnzm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/52n299f9xr7m6mv9p5av.png" alt="JSON format"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Spatial view
&lt;/h1&gt;

&lt;p&gt;You can now view data representing spatial values much easier than ever before.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---ZyCJXoQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/itabftbvsjjcqyobtfef.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---ZyCJXoQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/itabftbvsjjcqyobtfef.png" alt="Spatial view"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Saving cell contents to a file
&lt;/h1&gt;

&lt;p&gt;Having viewed the cell contents in the format you’ve chosen, you can then save it to a file and SQL Complete will automatically suggest you save it in the format you’ve worked with.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NlyRH_fw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kvbik2ts47gncbit8ws0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NlyRH_fw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kvbik2ts47gncbit8ws0.png" alt="Saving cell"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With the kind permission of Devart. Originally published at &lt;a href="https://blog.devart.com/get-the-most-from-your-data-with-sql-complete.html"&gt;https://blog.devart.com/get-the-most-from-your-data-with-sql-complete.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sql</category>
      <category>database</category>
      <category>visualization</category>
      <category>sqlserver</category>
    </item>
    <item>
      <title>Bulk Uploading To A MySQL Database: A Quick Guide</title>
      <dc:creator>Kate Naylor</dc:creator>
      <pubDate>Wed, 18 Mar 2020 15:21:14 +0000</pubDate>
      <link>https://dev.to/katenaylo/bulk-uploading-to-a-mysql-database-a-quick-guide-2dkd</link>
      <guid>https://dev.to/katenaylo/bulk-uploading-to-a-mysql-database-a-quick-guide-2dkd</guid>
      <description>&lt;p&gt;I recently got this question from a friend of mine, and the first thing I thought about was &lt;a href="https://www.devart.com/dbforge/mysql/studio/"&gt;dbForge Studio for MySQL&lt;/a&gt;. So, I quickly wrote a detailed instruction, and posting it here, as it may be useful to someone else.&lt;/p&gt;

&lt;p&gt;First of all,  let’s consider a set of files. These are sourced from the City of Los Angeles Open Data Portal and contains &lt;a href="https://data.lacity.org/browse"&gt;anonymized data on service calls made by the public to the Los Angeles Police Department&lt;/a&gt;.Each file contains a year’s worth of data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3fMccX0K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/j5gd6puxgeibq46zonkc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3fMccX0K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/j5gd6puxgeibq46zonkc.png" alt="Bulk Uploading 01"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each file has a set of fields:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A unique incident number&lt;/li&gt;
&lt;li&gt;Area where the incident occurred&lt;/li&gt;
&lt;li&gt;District where it was reported from&lt;/li&gt;
&lt;li&gt;Date of dispatch&lt;/li&gt;
&lt;li&gt;Dispatch time&lt;/li&gt;
&lt;li&gt;A call type code&lt;/li&gt;
&lt;li&gt;Call type description&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We have created a table called LAPD_Service_Calls with these fields in a test database:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lTeN6Try--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ytiywozpqzdm7nzci5ph.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lTeN6Try--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ytiywozpqzdm7nzci5ph.png" alt="Bulk Uploading 02"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To load a single data file, we can right click on the table and select “Import Data…” from the context menu:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9LRkjKHB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dmq3xk3rizb5mkzifyhk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9LRkjKHB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dmq3xk3rizb5mkzifyhk.png" alt="Bulk Uploading 03"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This starts the Import Data wizard. We select the CSV file option and choose the source file and then click “Next”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tV1VeeAw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/64inuib883r60jcy7q4q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tV1VeeAw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/64inuib883r60jcy7q4q.png" alt="Bulk Uploading 04"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the “Destination” screen, we have the database and the table already selected, so we click “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m4itu2r6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7jxpcpz0j9tobqvgmbfl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m4itu2r6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7jxpcpz0j9tobqvgmbfl.png" alt="Bulk Uploading 05"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the “Options” screen, we are not changing any of the options already selected for us. dbForge Studio for MySQL is smart enough to read the file, determine the header row, field separators etc. We click “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XexNEkFC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ngqlcyx739l84k11sts9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XexNEkFC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ngqlcyx739l84k11sts9.png" alt="Bulk Uploading 06"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We leave the “Data formats” screen as is, and click “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Xo32UpNB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/69sq08o68j0320ojkiyd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Xo32UpNB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/69sq08o68j0320ojkiyd.png" alt="Bulk Uploading 07"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next screen, we accept the mapping already defined and click “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mKgEP7r4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/aglnt64opqwa93rvpmgw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mKgEP7r4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/aglnt64opqwa93rvpmgw.png" alt="Bulk Uploading 08"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next screen, we accept the append-only and bulk insert mode of loading and click “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dff98fKw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tw7spnaybgv1658rrhtn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dff98fKw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tw7spnaybgv1658rrhtn.png" alt="Bulk Uploading 08"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the “Output” screen, we keep the option to import data directly into the database and click “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KXHXL0_3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/svipba529154ht41esfe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KXHXL0_3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/svipba529154ht41esfe.png" alt="Bulk Uploading 10"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the “Errors handling” screen, we select the option to abort the load after the first error:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xl25xGOz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/g7inioopfq88vbp7lbcn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xl25xGOz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/g7inioopfq88vbp7lbcn.png" alt="Bulk Uploading 09"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can now click the “Import” button to start importing the selected file. But we don’t want to load a single file - we want to load all the files.&lt;/p&gt;

&lt;p&gt;Most MySQL GUI tools will not have an answer for this scenario - but dbForge Studio for MySQL does. And this is possible through something called a “template”. Basically, a dbForge Studio data import or export template is a file that holds all the options you have chosen in the wizard. You can call this template from the dbForge Studio command line tool and pass it each data file name as an input parameter.&lt;/p&gt;

&lt;p&gt;To create the template, we select the down arrow key beside the “Save” button in the final screen, &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a0a7A-km--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dsdi3c24scem7boird2u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a0a7A-km--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dsdi3c24scem7boird2u.png" alt="Bulk Uploading 11"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and select “Save Template…” from the context menu. This will allow us to save the options as a Data Import Template (.DIT) file. Here, we are saving it in the same folder as the data files:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pO0qtvij--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8cit2by20y8sgzx3q7np.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pO0qtvij--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8cit2by20y8sgzx3q7np.png" alt="Bulk Uploading 12"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we write a small batch file like the one shown below, and save it in the data folder as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo off

set data_path="C:\Temp\Data_Import\*.csv"
dir /b /s %data_path% &amp;gt; load_file_list.txt


set apppath="C:\Program Files\Devart\dbForge Studio for MySQL\dbforgemysql.com"


if ERRORLEVEL 0 @(
echo on
for /F %%i in (load_file_list.txt) do @(
%apppath% /dataimport /templatefile:Load_LAP_Service_Calls_File.dit /inputfile:"%%i"
)
)
del load_file_list.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Here, we are calling a Windows directory command to get a list of the source data files and saving the output in a plain text file (load_file_list.txt). We then set the app path to the dbForge Studio for MySQL’s command line utility. Next, we start reading the file. For each source file name and path listed, we are calling dbForge Studio for MySQL’s command line tool and passing it the data import option (/dataimport). We are also specifying the template file to use (/templatefile:). In this case, it is the template file we created before. The final parameter is the input file for the template (/inputfile). We are passing the data file name here.&lt;/p&gt;

&lt;p&gt;We then run the batch file from the command prompt. The output will show data being loaded. After several minutes, all files are successfully loaded:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\Temp\Data_Import&amp;gt;data_import.bat

C:\Temp\Data_Import&amp;gt;echo off
=====================================================================Devart dbForge Studio 2019 for MySQL version 8.1.45.0
Copyright 2020 Devart. All rights reserved.
=====================================================================

Data import started at: 15/01/2020 10:00:32 PM

Import mode: Append

Importing data from LAPD_Calls_for_Service_2010.csv to table test_database.LAPD_Service_Calls:
916240 rows imported, 100%

Data import finished at: 15/01/2020 10:03:58 PM
=====================================================================
Devart dbForge Studio 2019 for MySQL version 8.1.45.0
Copyright 2020 Devart. All rights reserved.
=====================================================================

Data import started at: 15/01/2020 10:04:03 PM

Import mode: Append

Importing data from LAPD_Calls_for_Service_2011.csv to table test_database.LAPD_Service_Calls:
891376 rows imported, 100%

Data import finished at: 15/01/2020 10:07:23 PM
…
…
…

=====================================================================
Devart dbForge Studio 2019 for MySQL version 8.1.45.0
Copyright 2020 Devart. All rights reserved.
=====================================================================

Data import started at: 15/01/2020 10:33:25 PM

Import mode: Append

Importing data from LAPD_Calls_for_Service_2019.csv to table test_database.LAPD_Service_Calls:
2059515 rows imported, 100%

Data import finished at: 15/01/2020 10:40:25 PM
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As we just saw, &lt;a href="https://www.devart.com/dbforge/mysql/studio/"&gt;dbForge Studio for MySQL&lt;/a&gt; successfully bulk-loaded data from a number of files into a target table with very minimal effort.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>database</category>
      <category>data</category>
      <category>mysql</category>
    </item>
    <item>
      <title>Creating Professional Reports From MySQL Data</title>
      <dc:creator>Kate Naylor</dc:creator>
      <pubDate>Mon, 16 Mar 2020 16:02:38 +0000</pubDate>
      <link>https://dev.to/katenaylo/creating-professional-reports-from-mysql-data-4e5</link>
      <guid>https://dev.to/katenaylo/creating-professional-reports-from-mysql-data-4e5</guid>
      <description>&lt;p&gt;For this purpose I would recommend &lt;a href="https://www.devart.com/dbforge/mysql/studio/" rel="noopener noreferrer"&gt;dbForge Studio for MySQL&lt;/a&gt;. The tool offers a whole gamut of features for developing and managing MySQL databases. However, it also has very powerful capabilities to create professional reports from MySQL data. Let’s show this with an example.&lt;/p&gt;

&lt;p&gt;Let’s say, we are working with the MySQL sample database world_x. It has four tables:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fd8uvfb4zu90mmwkszvmt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fd8uvfb4zu90mmwkszvmt.png" alt="Reports From MySQL Data 01"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We would like to create a report showing details about each country: its name, its capital city, the continent where it’s located and its total population. Along with these, we would also like to list different cities and towns of the country and their populations.&lt;/p&gt;

&lt;p&gt;We have written the following query to get all the relevant info:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

USE world_x;

SELECT 
    country.Code AS Country_Code,
    country.Name AS Country_Name,
    country_info.Continent AS Continent,
    country_info.Region AS Region,
    country_info.Population AS Country_Total_Population,
    city1.CityName AS Capital_City,
    city2.CityName AS Country_City,
    city2.Population AS City_Population
FROM
    country
      INNER JOIN 
          (
          SELECT 
            doc-&amp;gt;&amp;gt;'$._id' AS CountryCode,
            doc-&amp;gt;&amp;gt;'$.Name' AS Country,
            doc-&amp;gt;&amp;gt;'$.geography.Continent' AS Continent,
            doc-&amp;gt;&amp;gt;'$.geography.Region' AS Region,
            doc-&amp;gt;&amp;gt;'$.demographics.Population' AS Population
          FROM 
            countryinfo
          ) AS country_info
          ON country.Code = country_info.CountryCode AND country.Name = country_info.Country
            INNER JOIN
              (
              SELECT 
                ID,
                Name AS CityName,
                CountryCode
              FROM 
                city
                ) AS city1
                ON city1.ID = country.Capital AND city1.CountryCode = country.Code
                  INNER JOIN
                    (
                    SELECT 
                      ID,
                      Name AS CityName,
                      CountryCode,
                      Info-&amp;gt;'$.Population' AS Population
                    FROM 
                      city
                    ) AS city2
                    ON city2.CountryCode = country.Code
ORDER BY
    2
;  


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now, we can use this query as a data source to build a report. To do this, we choose the “Database &amp;gt; Report Designer…” option from the main menu. This starts a  data report wizard:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fglh9di8pi95tfvk5rar3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fglh9di8pi95tfvk5rar3.png" alt="Reports From MySQL Data 02"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We keep the default option selected (Standard Report) and click “Next”.&lt;/p&gt;

&lt;p&gt;In the next screen, we choose our database connection and select the option to run a custom query. Then we click “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhabj8kqaiax5kx46fr3n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fhabj8kqaiax5kx46fr3n.png" alt="Reports From MySQL Data 03"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next screen, we paste the query we showed above and click “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flowx3bmnht9e09w5zu9u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flowx3bmnht9e09w5zu9u.png" alt="Reports From MySQL Data 04"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next screen, we choose the fields we would like to display in the report, and click “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdr84lty4tfxkx6g079bv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdr84lty4tfxkx6g079bv.png" alt="Reports From MySQL Data 05"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the following screen, we choose two grouping levels. However, we will change this later. Once we choose the grouping levels, we click “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fo2olcqv2ezyfg59x1l9y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fo2olcqv2ezyfg59x1l9y.png" alt="Reports From MySQL Data 06"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the following screen, we keep the stepped layout for the report and the portrait orientation, and click “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftzhf8tmrbw4hohh3vafe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftzhf8tmrbw4hohh3vafe.png" alt="Reports From MySQL Data 07"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next screen, we select the “Casual” reporting style and click “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Foqoo6wyv496w7dwnp2pn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Foqoo6wyv496w7dwnp2pn.png" alt="Reports From MySQL Data 08"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the final screen of the wizard, we provide a title for the report and click “Finish”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpgnak01qjpdu2dbrcqx4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpgnak01qjpdu2dbrcqx4.png" alt="Reports From MySQL Data 09"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;dbForge Studio for MySQL now generates a report for us, and opens that in a design palette:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjyfk9lbueka3zf9wz53t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjyfk9lbueka3zf9wz53t.png" alt="Reports From MySQL Data 10"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We won’t go into the nitty gritty here, but after some changes, here is our report’s final design:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fshpobqa9moawewaz778k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fshpobqa9moawewaz778k.png" alt="Reports From MySQL Data 11"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this is how it looks like in HTML preview:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw52xe23mhch7txuyv5l5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw52xe23mhch7txuyv5l5.png" alt="Reports From MySQL Data 12"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, you may wonder if the report elements provided by the wizard are all you can get. That’s not the case. Here are the controls you can use in your reports:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffy2ja8mb0hkxp0vihkss.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffy2ja8mb0hkxp0vihkss.png" alt="Reports From MySQL Data 13"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here are the alignment options:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9vagn8f0g70uxpcdci46.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9vagn8f0g70uxpcdci46.png" alt="Reports From MySQL Data 14"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is also a scripting option to respond to dynamic events:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6ir0n2owejpjqyz12z9v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6ir0n2owejpjqyz12z9v.png" alt="Reports From MySQL Data 15"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And finally, you can export your finished report to different formats:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Faxv96wzzm6r1qs99023m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Faxv96wzzm6r1qs99023m.png" alt="eports From MySQL Data 16"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also send the report in any of these formats via email to your coworkers.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>mysql</category>
      <category>database</category>
      <category>reports</category>
    </item>
    <item>
      <title>Backing Up a Database in Amazon RDS for MySQL</title>
      <dc:creator>Kate Naylor</dc:creator>
      <pubDate>Fri, 13 Mar 2020 15:52:23 +0000</pubDate>
      <link>https://dev.to/katenaylo/backing-up-a-database-in-amazon-rds-for-mysql-1553</link>
      <guid>https://dev.to/katenaylo/backing-up-a-database-in-amazon-rds-for-mysql-1553</guid>
      <description>&lt;p&gt;&lt;em&gt;A quick guide on how to back up the sample sakila database with &lt;a href="https://www.devart.com/dbforge/mysql/studio/"&gt;dbForge Studio for MySQL&lt;/a&gt;. Probably, would be useful for beginners.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let’s go straight to the business. Here, we are connected to an Amazon RDS MySQL instance. We are interested in backing up the sample sakila database (which is not large - but we will get to that very shortly). We right click on the database and then choose “Backup and Restore” &amp;gt; “Backup Database...” option from the context menu:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sEVwbjVI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/vsxo2dldvcigvumrwu13.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sEVwbjVI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/vsxo2dldvcigvumrwu13.png" alt="Backing Up a Database in Amazon RDS_01"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This starts the Database Backup Wizard. From the first screen, we can see the database connection and the database is already selected for us. We can see &lt;strong&gt;dbForge Studio&lt;/strong&gt; has selected a default backup path and file name for us as well. The file name defaults to the database name and we can also opt to append a timestamp at the end of the file name. Also, there’s an option to delete backup files older than a configurable period of time. There are options to compress the backup file and to encrypt it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tWYfib7g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wd1wtoxsg7xyzvlli889.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tWYfib7g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wd1wtoxsg7xyzvlli889.png" alt="Backing Up a Database in Amazon RDS_02"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With the options chosen, we click “Next”. In the next screen, we can choose if we want to backup only the database structure, only the data or both. In this case, we are backing up both. Note how we can include or exclude different types of objects from our backup. Again, we are including all objects and then clicking “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NuHkRhNv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/drg0zyyam6ho2evt1o90.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NuHkRhNv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/drg0zyyam6ho2evt1o90.png" alt="Backing Up a Database in Amazon RDS_03"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next screen, we can choose some extra options. Here, we want dbForge Studio to flush the logs to disk before the backup. We can also choose other options (not visible here) like including database users and roles. Once happy with the options, we click “Next”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4SoGwybR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7lby1dhppb4ddn19kr0m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4SoGwybR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7lby1dhppb4ddn19kr0m.png" alt="Backing Up a Database in Amazon RDS_04"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The final screen asks us how we want to handle any errors. For manual backups, we can choose the first option: to prompt us. For automated backups, we can choose the third option (abort on first error) and also write to a log file:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HxU7XMTl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cp3j4fg01sg2rmheg3ko.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HxU7XMTl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cp3j4fg01sg2rmheg3ko.png" alt="Backing Up a Database in Amazon RDS_05"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, clicking on the “Backup” button will start the backup, and it will be a manual backup. Most tools in the market would give you this type of facility.&lt;/p&gt;

&lt;p&gt;What sets dbForge apart is that you can save the options you have chosen so far as a command line script. &lt;/p&gt;

&lt;p&gt;Why would you want that? Well, backing up large databases can take time and when you do it manually, any client application can seem to have become unresponsive. Particularly GUI tools seem frozen. In reality though, the backup client is waiting for a synchronous operation to complete, sometimes delayed by network latency. Also, you would want a command-line alternative so you can schedule the backup the task.&lt;/p&gt;

&lt;p&gt;Instead of clicking the “Backup” button, If we click the down arrow key beside the “Save” button, we will see an option “Save Command Line…”. Selecting that option will open the dialog box below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oflnMLAU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lvts15s14a1ixfb8vmpq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oflnMLAU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lvts15s14a1ixfb8vmpq.png" alt="Backing Up a Database in Amazon RDS_06"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From here, you can copy the generated command with all the options and save it as a Windows command file. In the snippet below, we are calling a script file. This script file has a single line, and that line is this generated command. The output is also shown:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;c:\Temp&amp;gt;backup.cmd

c:\Temp&amp;gt;"C:\Program Files\Devart\dbForge Studio for MySQL\dbforgemysql.com" /backup /connection:"User Id=administrator;Password=xxxxxxxx;Host=dev-mysql.xxxxxxxxi.us-east-1.rds.amazonaws.com;Database=sakila;Enlist=False;Transaction Scope Local=True;Character Set=utf8" /database:sakila /outputfile:"C:\Temp\mysql-db\Backup\sakila 20200114 0150.zip"
=================================================================
Devart dbForge Studio 2019 for MySQL version 8.1.45.0
Copyright 2020 Devart. All rights reserved.
=================================================================

Database backup started at: 14/01/2020 4:06:16 AM

Exporting (100%): Done


Objects processed: 26
Rows processed: 25020
Backup file: C:\Temp\mysql-db\Backup\sakila 20200114 0150.zip

Database backup finished at: 14/01/2020 4:07:16 AM
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As you can imagine, we could have scheduled this command script. This would be ideal for  large databases because we would not have to worry about any timeouts or any unresponsive clients.&lt;/p&gt;

</description>
      <category>mysql</category>
      <category>database</category>
      <category>amazon</category>
      <category>backup</category>
    </item>
    <item>
      <title>Visually Creating MySQL Queries With dbForge Studio for MySQL</title>
      <dc:creator>Kate Naylor</dc:creator>
      <pubDate>Wed, 19 Feb 2020 16:41:48 +0000</pubDate>
      <link>https://dev.to/katenaylo/visually-creating-mysql-queries-with-dbforge-studio-for-mysql-5530</link>
      <guid>https://dev.to/katenaylo/visually-creating-mysql-queries-with-dbforge-studio-for-mysql-5530</guid>
      <description>&lt;p&gt;&lt;em&gt;This small guidance will be useful for non-technical users who have limited knowledge of the SQL language and want to explore the data. And also for savvy SQL developers who might be struggling with a particular complex query. As the graphical tool can be an intuitive way to build the query’s logic.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Fortunately, we have &lt;a href="https://www.devart.com/dbforge/mysql/studio/"&gt;dbForge Studio for MySQL&lt;/a&gt; whose graphic designer allows us to select fields from multiple related tables and views, use search conditions, build subqueries, insert MySQL functions, create aggregations sort by different orders and so on. And we come to talk about this tool.&lt;/p&gt;

&lt;p&gt;Basically, when developing your query visually with dbForge, you can easily switch to the text view to see the SQL text that’s being generated. You can also check the data view to see the data returned. This is great for debugging purposes. &lt;/p&gt;

&lt;p&gt;Once happy, you can save the query as an SQL script file, use it as a data source for creating a report or simply save the text as a code snippet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here is an example.&lt;/strong&gt; &lt;br&gt;
We are looking at a simple MySQL sample database called employees. It has a few tables typical of any HR system:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nPZfI3F9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/0jgCSDY/image14.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nPZfI3F9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/0jgCSDY/image14.png" alt="employees MySQL sample database"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s say, as HR users, we want to check the past employees of the company. We want to see the departments they have worked in. We want to see the job titles they held in those departments when employed, and the time they held each job title.&lt;/p&gt;

&lt;p&gt;We can either write an SQL query, or we can click the “New Query” button in the toolbar:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7wePpfU_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/bFLkpW9/image35.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7wePpfU_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/bFLkpW9/image35.png" alt="Toolbar"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This opens a new query window with an empty palette. We can select the relevant tables from the “Database Explorer” pane to the palette. dbForge Studio automatically shows any existing relationship between tables:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QL80wkf8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/RB4Yyrt/image9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QL80wkf8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/RB4Yyrt/image9.png" alt="Existing relationship"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under the palette, a tabbed dialog also appears. These tabs allow you to select one or more fields, change, insert or delete joining clauses and specify WHERE, GROUP BY, HAVING and ORDER BY clauses:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FooSvDQr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/swnZLGT/image52.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FooSvDQr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/swnZLGT/image52.png" alt="tabbed_dialog_01"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ir7kUWor--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/FHFZ3JR/image71.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ir7kUWor--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/FHFZ3JR/image71.png" alt="tabbed_dialog_02"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cWvkCn_l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/s9hnwHW/image53.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cWvkCn_l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/s9hnwHW/image53.png" alt="tabbed_dialog_03"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fVGbumOa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/3z2MPTY/image15.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fVGbumOa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/3z2MPTY/image15.png" alt="tabbed_dialog_04"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UZINibxc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/C5VfJcW/image63.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UZINibxc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/C5VfJcW/image63.png" alt="tabbed_dialog_05"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bw42zHOX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/rwFjh0X/image8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bw42zHOX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/rwFjh0X/image8.png" alt="tabbed_dialog_06"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will intentionally use a subquery here. We will select a subset of rows from the dept_emp table where the to_date field is not equal to ‘9999-01-01’ - in other words the employee is no longer active. To create a subquery, we right click on an empty space in the palette and choose “Create Subquery” from the context menu:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Q0_WBLqR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/BGMrGzs/image69.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Q0_WBLqR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/BGMrGzs/image69.png" alt="Context menu"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This opens another sub-tab under the main query tab. The original palette’s tab is shown as “Root Query” and the new palette’s tab is shown as “SubQuery”:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6QMks7R2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/MP0Swvk/image11.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6QMks7R2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/MP0Swvk/image11.png" alt="Root Query"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we get rid of the dept_emp table from the “Root Query” palette by selecting it and pressing Delete: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SC2cka9O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/L6k62YP/image12.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SC2cka9O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/L6k62YP/image12.png" alt="dept_emp"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the “SubQuery” palette, we drag the dept_emp table only. For this table, we are selecting all fields. In the “Where” tab below it, we specify our selection condition:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--12gyx2pe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/2K4W7m8/image76.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--12gyx2pe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/2K4W7m8/image76.png" alt="specify our selection condition_01"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wvF-4RdX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/Sw23fXQ/image6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wvF-4RdX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/Sw23fXQ/image6.png" alt="specify our selection condition_02"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oBbUuksS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/Jsbx2xP/image2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oBbUuksS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/Jsbx2xP/image2.png" alt="specify our selection condition_03"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We double click on the box’s title “SubQuery”, change it to “dept_emp2”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T5L6D169--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/QDMZdMQ/image86.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T5L6D169--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/QDMZdMQ/image86.png" alt="dept_emp2 change"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We then drag the “dept_no” field from the “departments” table’s box to “dept_emp2”, and drag the “emp_no” field from “employees” to “dept_emp2”. The palette should look something like the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TYZ8QFFj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/ydVSJm9/image3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TYZ8QFFj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/ydVSJm9/image3.png" alt="dept_no_departments"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we select different fields from the tables, create two calculated fields, specify a WHERE condition and order by two fields:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kQ6dDMmy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/TvchS9X/image19.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kQ6dDMmy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/TvchS9X/image19.png" alt="two calculated fields"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we switch to the “Text” tab at the bottom of the query window:, we can see the SQL text that was generated:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
  employees.emp_no AS Employee_No,
  CONCAT(employees.first_name, ' ', employees.last_name) AS Employee_Name,
  departments.dept_name AS Department,
  dept_emp2.from_date AS Worked_in_Department_From,
  dept_emp2.to_date AS Worked_in_Department_To,
  titles.title AS Job_Title,
  titles.from_date AS Worked_in_Role_From,
  titles.to_date AS Worked_in_Role_To,
  DATEDIFF(titles.to_date, titles.from_date) AS Days_Worked_in_this_Role
FROM employees
  INNER JOIN titles
    ON titles.emp_no = employees.emp_no
  INNER JOIN (SELECT
      dept_emp.emp_no,
      dept_emp.from_date,
      dept_emp.dept_no,
      dept_emp.to_date
    FROM dept_emp
    WHERE dept_emp.to_date &amp;lt;&amp;gt; '9999-01-01') dept_emp2
    ON employees.emp_no = dept_emp2.emp_no
  INNER JOIN departments
    ON departments.dept_no = dept_emp2.dept_no
WHERE titles.to_date &amp;lt;&amp;gt; '9999-01-01'
ORDER BY Employee_Name, Worked_in_Role_From DESC
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Clicking on the “Execute” button from the toolbar will show the data in a grid in the “Data” tab:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4GqI3AGq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/s9YWKGq/image81.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4GqI3AGq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.ibb.co/s9YWKGq/image81.png" alt="data in a grid"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So this is how you can visually build queries in &lt;a href="https://www.devart.com/dbforge/mysql/studio/"&gt;dbForge Studio for MySQL&lt;/a&gt;. Needless to say, production grade queries in a database application can be really complex, but once you know the basics, you can easily break those queries down and start building the subqueries in the query builder. Also, we have not touched on other types of joins (the example here showed only inner joins) and other query types (INSERT, UPDATE , DELETE etc.). All these can be set and configured from the query builder.&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;

</description>
      <category>database</category>
      <category>sql</category>
      <category>query</category>
      <category>dbforge</category>
    </item>
  </channel>
</rss>
