Showing entries 1 to 8
Displaying posts with tag: technical blogs (reset)
Use MySQL to generate MySQL for Admin tasks

I recently learned how to use MySQL to generate MySQL statements for several admin-type Data Definition Language (DDL) SQL queries I needed to execute on the server. For many DBA’s this is likely nothing new and in fact, is a well-used tool in their kit. However, I mostly focus on developer-related tasks, so it is a fresh-in-my-mind learning experience. Continue reading for more information…

Some backstory for context

I’ve recently been porting over an existing vanilla PHP application to CodeIgniter 4. One of the new features is bootstrapping all of the necessary MySQL CREATE TABLE statements dynamically based on information parsed from a .fxl file (which is close kin to a .xml file structure-wise).

Each CREATE TABLE statement is complete with FOREIGN KEY constraint clauses to ensure data integrity between linking …

[Read more]
MySQL Table DDL file with phpMyAdmin

If you need a structure only .sql file of a MySQL tables’ Data Definition Language (DDL), phpMyAdmin makes this super-easy with just a few clicks. Continue reading and learn how…

Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!

Why use a DDL file?

Why would you need a structure-only .sql DDL file anyway?

Maybe you want to build out a tables’ structure on another server to bring in different data or something comparable, and want it void of any existing data.

Rather than creating the …

[Read more]
Medium Cross-post – CodeIgniter 4 CRUD: Read

Storing data is but one part of many in application development. Once data is stored, interested parties will likely want to see it. This is the Read aspect of CRUD – reading (or viewing) the data. Continue reading and see examples using CodeIgniter 4 built-in Model methods…

Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!

In part 1 of this series, CodeIgniter 4 CRUD with MySQL: Create, I used the Model insert() method to store new rows of data. Now that the data is present in the table, we want to see that data.

There are 2 built-in Model …

[Read more]
MySQL Searched CASE Expression – with examples

During many decision-making phases in programming code (conditional logic), there are times execution depends on several different factors. Multiple conditional tests are powerful and constraining, oftentimes requiring more than one test to be passed in order for program flow to proceed. For MySQL (and standard SQL in general) the CASE expression is used for IF/THEN/ELSE conditional logic. The post, MySQL Simple CASE Expression – with examples, covered Simple CASE queries which are essentially equality tests. MySQL Simple CASE is but one variant of 2, with the other being a MySQL Searched CASE Expression.  A MySQL Searched CASE Expression can have multiple conditional tests in each WHEN

[Read more]
MySQL Simple CASE Expression – with examples

Programming logic is foundational in any application or piece of software. Without it, software wouldn’t really do much of anything. Everything happens off of choice. In the end, some truthy or falsy value is what makes stuff work. For IF/THEN/ELSE logic in standard SQL, there is the CASE expression. There are 2 variations of the CASE Expression: Simple and Searched. In this post, I cover the Simple MySQL CASE expression with example queries…

Image by Nika Akin from …

[Read more]
MySQL Column Aliases using the AS keyword

Be it running reports or displaying data in some other visualization, SQL SELECT column expressions should be meaningful and understandable. To provide those valuable query results, SQL Developers, use a multitude of available functions, adjacent columns, or other means not readily apparent to end-users. All that being said, the column names often suffer the most as far as readability is concerned, taking on long function call names or other combined expressions. But, as luck would be on our side, there is an easy fix and that is aliasing columns using the AS keyword. Although AS is optional – in this particular context – I err on the side of readability and use it when aliasing SELECT column expressions.

Image by …

[Read more]
MySQL Count Weekday occurrences

Each SQL dialect is different in some way, shape, form, or fashion from the next flavor. Some dialects have this function, while others have that function. In this post, I cover porting over Oracle SQL to MySQL in order to count the number of occurrences of a specific weekday found in the current given month (at the time of writing) purely as a learning exercise focused on MySQL DATE functions and the WITH clause…

Image by tigerlily713 from Pixabay

[Read more]
MySQL Aggregate Query using CodeIgniter’s Query Builder

CodeIgniter’s Query Builder ORM has class methods for nearly any kind of database access/operation you can think of. In this post, I’ll cover some of the available methods for retrieving aggregate-level query results. The examples in this post map out Query Builder method chaining to produce results you would get from a raw MySQL query. Continue reading to see more…

Image by Clker-Free-Vector-Images from Pixabay

Self-Promotion:

If you enjoy the content written here, by …

[Read more]
Showing entries 1 to 8