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
…
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]
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.
Any of you who read my blog posts here regularly know I am passionate about SQL, PHP, and Back-end Development. I consider writing an integral part of my brand and growth. Continue reading and learn more about what’s on my mind lately with writing and code…
Image by Arek Socha from Pixabay
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. …
[Read more]Sometimes clients want that the information they collected from the user should be encrypted and stored in a database. Data encryption and…
Continue reading on Thinkdiff »
[Read more]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]
Most developers use some form of auto-incrementing integer
counter for a given database table, ensuring uniqueness
among the rows. Several of the popular SQL dialects implement
this facility. For instance, MySQL’s AUTO_INCREMENT
attribute is used to provide a unique identity for a table row.
What exactly is the behavior of AUTO_INCREMENT
? Can
you explicitly use a value of your choosing for it if you need
to? How does it count? Continue reading and know the answers to
these questions and more…
Image by Gerd Altmann from …
[Read more]I recently published a blog post about a portfolio project I am developing using the LAMP stack, Bootstrap 4, jQuery, and the MVC (Model-View-Controller) design pattern in core PHP. In this post, I will introduce an additional feature I integrated into the existing project.
Self-Promotion:
If you enjoy the content written here, by all means, share this blog and …
[Read more]I am super pleased to share that I have completed and uploaded my first (that I can share at least) personal portfolio piece written in PHP to a subdomain on my personal hosting server located at walk.openlamp.tech. Over the better part of the last year, I have developed a custom reporting dashboard written in PHP for my (current) employer, but do not share any of that work as it is proprietary and not owned by me. However, for a personal project, I can share far and wide. In this post, I provide a brief overview of my simple (in theory at least) application/site, built on the LAMP stack using the MVC (Model-View-Controller) design pattern in core PHP along with Bootstrap 4, jQuery, and MySQL.
[Read more]Having spent the majority of this year programming a custom reporting dashboard for my employer written in PHP and MySQL, it is an understatement to say that I have learned a lot. Nothing beats real-world experience and I really have come into my own with PHP, learning more and more daily as I continue progressing forward on my goal of becoming a Back-End Web Developer. I have written several PHP-related posts this year and wanted to provide them all in one easy-to-access list. Enjoy!
Image by Aleksey Nemiro from …
[Read more]