Navicat Blog

Atomicity in Relational Databases Mar 30, 2021 by Robert Gravelle

Not so long ago, the word "atom" referred to a thing that could not be split any further. Despite having discovered that atoms themselves are made up of even smaller particles, the term continues to retain its original meaning. With respect to relational databases, Atomicity means that operations (DMLs/DDLs, etc.) executed by the database will be atomic. The unit of atomicity usually provided by relational databases is a transaction. Why is this important? A guarantee of atomicity prevents updates to the database occurring only partially, which can cause greater problems than rejecting the whole series of operations outright. In today's blog, we'll learn what Atomicity is and how to enforce it within your database instances.

Using Group By and Order By in the Same Query Mar 25, 2021 by Robert Gravelle

Both GROUP BY and ORDER BY are clauses (or statements) that serve similar functions; that is to sort query results. However, each of these serve very different purposes; so different in fact, that they can be employed separately or together. And that is where things can get a little dicey if you are unsure of what you're doing. In today's blog, we'll learn what each clause does and how to use them together for the ultimate control over your query output. To do that we'll be using Navicat Premium against the Sakila Sample Database.

Calculating Daily Average Date/Time Intervals in MySQL Mar 19, 2021 by Robert Gravelle

In previous blog, we tabulated the average daily counts for a given column in SQL Server using Navicat for SQL Server. In today's follow-up, we're going to raise the difficulty factor slightly by calculating the daily average date/time interval that is based on start and end date columns. For demonstration purposes, I'll be working with MySQL using Navicat Premium.

Querying Multiple Tables without Joins Mar 15, 2021 by Robert Gravelle

Normally, querying a normalized database necessitates joining tables together on one or more common fields. Otherwise, you risk generating a cartesian product. That is a result set whose number of rows equals those in the first table multiplied by the number of rows in the second table. So, if the input contains 1000 persons and 1000 phone numbers, the result consists of 1,000,000 pairs! Not good. Having said that, if you wanted to aggregate data from similar tables that are not directly related, you can do that using the UNION operator. In today's blog, we'll learn some of the finer points on using UNION, along with its close cousin, UNION ALL.

Three Ways to Perform Bulk Inserts Mar 3, 2021 by Robert Gravelle

I recently wrote a node.js script to iterate over millions of files per day and insert their contents into a MySQL database. Rather than process one record at a time, the script stored file contents in memory and then ran an INSERT statement every 1000 files. To do that, I used the bulk insert form of the INSERT statement. Depending on your particular requirements, you may opt to go with a different solution. In today's blog, we'll go over a few alternatives.

Navicat Blogs
Feed Entries
Blog Archives
Share