When it comes to storing formatted fields in a database, the adage "store raw, display pretty", usually holds true. In most cases, raw values are the most conducive for working with in the database, allowing them to be queried, sorted, compared, and what-have-you. Yet, there are times that you may want to leave in special characters, where they are essential to formatting, such as HTML markup. In today's blog, we'll explore both options with examples using Navicat Premium.
Adding the DISTINCT keyword to a SELECT query causes it to return only unique values for the specified column list so that duplicate rows are removed from the result set. Since DISTINCT operates on all of the fields in SELECT's column list, it can't be applied to an individual field that are part of a larger group. That being said, there are ways to remove duplicate values from one column, while ignoring other columns. We'll be taking a look at a couple of those here today.
Grouping query results into buckets of equal size is a common requirement for database developers and database administrators (DBAs) alike. Examples include:
- customers whose last names begin with A - L and M-Z
- products prices that are between 1 - 10 dollars, 11 - 20 dollars, 21 - 20 dollars, etc...
- quarterly sales, i.e., from Jan - Mar, Apr - Jun, Jul- Sep, Oct - Dec
Standard SQL is well suited to this task. By combining the power of the CASE statement with the GROUP BY clause, data can be broken up into whatever range we deem necessary to best interpret our data. In today's blog, we'll compose a couple of range queries in Navicat Premium's excellent Query Editor.
Output parameters are a feature of stored procedures that is seldom used, which is a shame because they are an excellent option for returning scalar data to the user. In today's blog, we'll learn some uses for Output Parameters and how to use them in your stored procedures.
Theres an adage for user privileges that you should assign a user the least amount of privileges that he or she requires to perform their job function(s) and no more. That is why MySQL offers such a fine-grained access control system. While not the easiest system to grasp, once a DBA does, he or she tends to agree that it really is quite effective. In today's blog, we'll learn how to prevent a user from listing databases in MySQL.
- 2024 (1)
- 2023 (1)
- 2022 (1)
- 2021 (1)
- 2020 (1)
- 2019 (1)
- 2018 (1)
- 2017 (1)