Showing entries 51 to 60 of 1180
« 10 Newer Entries | 10 Older Entries »
Displaying posts with tag: sql (reset)
Dynamic Drop Table

I always get interesting feedback on some posts. On my test case for discovering the STR_TO_DATE function’s behavior, the comment was tragically valid. I failed to cleanup after my test case. That was correct, and I should have dropped param table and the two procedures.

While appending the drop statements is the easiest, I thought it was an opportunity to have a bit of fun and write another procedure that will cleanup test case tables within the test_month_name procedure. Here’s sample dynamic drop_table procedure that you can use in other MySQL stored procedures:

CREATE PROCEDURE drop_table
( table_name  VARCHAR(64))
BEGIN
 
  /* Declare a local variable for the SQL statement. */
  DECLARE stmt VARCHAR(1024);
 
  /* Set a session variable with two parameter markers. */
  SET @SQL := CONCAT('DROP TABLE ',table_name);
 
  /* Check if the …
[Read more]
str_to_date Function

As many know, I’ve adopted Learning SQL by Alan Beaulieu as a core reference for my database class. Chapter 7 in the book focuses on data generation, manipulation, and conversion.

The last exercise question in my check of whether they read the chapter and played with some of the discussed functions is:

  1. Use one or more temporal function to write a query that convert the ’29-FEB-2024′ string value into a default MySQL date format. The result should display:
    +--------------------+
    | mysql_default_date |
    +--------------------+
    | 2024-02-29         |
    +--------------------+
    1 row in set, 1 warning (0.00 sec)
    

If you’re not familiar with the behavior of MySQL functions, this could look like a difficult problem to solve. If you’re risk inclined you would probably try the STR_TO_DATE function but if you’re not risk inclined the description of the %m specifier might suggest you …

[Read more]
Case Sensitive Comparison

Sometimes you hear from some new developers that MySQL only makes case insensitive string comparisons. One of my students showed me their test case that they felt proved it:

SELECT STRCMP('a','A') WHERE 'a' = 'A';

Naturally, it returns 0, which means:

  • The values compared by the STRCMP() function makes a case insensitive comparison, and
  • The WHERE clause also compares strings case insensitively.

As a teacher, you’re gratified that the student took the time to build their own use cases. However, in this case I had to explain that while he was right about the STRCMP() function and the case insensitive comparison the student used in the WHERE clause was a choice, it wasn’t the only option. The student was wrong to conclude that MySQL couldn’t make case sensitive string comparisons.

I modified his sample by adding the required BINARY keyword for a case sensitive comparison in …

[Read more]
Find the first and last day of a month with MySQL – Medium repost

Knowing the first and last day of a given month can help you figure out other information relevant and important data. You can determine these values using select MySQL date functions. Learn how in this Medium post I’m resharing here for any interested readers…

Get tailored articles with Refind delivered each day in your inbox. Refind is part of my daily reading habit. Make it part of yours by using my referral link. At no additional cost to you, I will be eligible for a premium subscription with more sign-ups from my link. The essence of the web, every morning in your inbox. Subscribe for free

The Newsletter for PHP and MySQL Developers

Receive a copy of my ebook, “10 MySQL Tips For Everyone”, absolutely free when you subscribe to the …

[Read more]
OpenLampTech MySQL Extras – Substack Writing

Not only do I share the weekly OpenLampTech newsletter, but I’m also publishing some articles outside of the publication, directly to my Substack page. I’m resharing the last 2 I’ve posted over on my Substack for any interested readers…

Do you need to learn MySQL? Just starting and confused about how to query a table and get the data you need? I am creating premium MySQL Beginners content for this specific reason. To help those who want to learn the basics of MySQL but don’t know where to start. Learn more about the premium blog posts as I develop and release them.

Tell me more!

MySQL SHOW TABLES – Two Variations

This post is an excerpt from some premium content I am creating here on my blog for beginners wanting to learn MySQL.

Read the full substack article: …

[Read more]
OpenLampTech issue #12 – My RTC Interview

Hey hey! Glad you are here for this week’s issue of OpenLampTech, the newsletter for PHP/MySQL developers. You are going to love what’s in this publication. I’m sharing some of my personal Developer stories which have never been published online anywhere else before. Enjoy!

Do you need to learn MySQL? Just starting and confused about how to query a table and get the data you need? I am creating premium MySQL Beginners content for this specific reason. To help those who want to learn the basics of MySQL but don’t know where to start. Learn more about the premium blog posts as I develop and release them.

Tell me more!

Image by  …

[Read more]
OpenLampTech issue #11 – MySQL LAG()

Wow! Eleven issues so far! Are you ready for your weekly source of original and curated PHP/MySQL content? Ready to learn and grow as a backend developer? Well, you are in luck because OpenLampTech, the newsletter for PHP/MySQL developers, is out and ready for you. Dig in!!!

Do you need to learn MySQL? Just starting and confused about how to query a table and get the data you need? I am creating premium MySQL Beginners content for this specific reason. To help those who want to learn the basics of MySQL but don’t know where to start. Learn more about the premium blog posts as I develop and release them.

Tell me more!

Image by  …

[Read more]
Query Results to CSV with MySQL Workbench – Medium cross-post

We know how common and useful CSV files are. If you need to save a particular query’s results to a CSV file, it couldn’t be easier than with MySQL Workbench. I recently wrote a quick post over on my Medium account covering this and am sharing it here for any interested readers…

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!

Image by  …

[Read more]
OpenLampTech issue #10

I keep rolling in with new issues of OpenLampTech, the newsletter for PHP/MySQL developers and you keep reading them. Sounds like a fair trade to me! I have another fantastic, huge issue for all of your reading enjoyment in the PHP/MySQL world…

Get tailored articles with Refind delivered each day in your inbox. Refind is part of my daily reading habit. Make it part of yours by using my referral link. At no additional cost to you, I will be eligible for a premium subscription with more sign-ups from my link. The essence of the web, every morning in your inbox. Subscribe for free

The Newsletter for PHP and MySQL Developers

Let’s get right to …

[Read more]
Fill in missing Date ranges using MySQL

I’m always trying different programming exercises in order to learn and grow as a Developer. One of my favorite learning exercises is porting over from one SQL dialect to another, as they all have their own individual features. Having to hack together or mirror non-existent functionality really challenges my thinking, therefore enabling growth and improvement in my query skills. In this post, I share reproducing the same query results using MySQL for queries I first learned of/discovered that were covered using Oracle SQL and specific implementation features…

Image by José Augusto …

[Read more]
Showing entries 51 to 60 of 1180
« 10 Newer Entries | 10 Older Entries »