Showing entries 51 to 60 of 980
« 10 Newer Entries | 10 Older Entries »
Displaying posts with tag: database (reset)
MySQL Query from JSON

One of my students asked how you could get JSON data out in tabular format. I said they should look at Øystein Grøvlen’s JSON_TABLE – Best of Both Worlds blog post from 2018. Unfortunately, the student wanted another example with the Video Store model that we use in class.

For clarity, all path definitions start with a $ followed by other selectors:

  • A period followed by a name, such as $.website
  • [N] where N is the position in a zero-indexed array
  • The .[*] wildcard evaluates all members of an object
  • The [*] wildcard evaluates all members of an array
  • The prefix and suffix wildcard, **, evaluates to all paths that begin with the named prefix and end with the named suffix

So, here’s a quick supplement to what’s already there. It assumes you created an …

[Read more]
MySQL Backslashes

Yesterday, I wrote a blog post that showed you how to write a query returning a JSON structure for a 1:many relationship. The relationship was between the member and contact table. It returns one account_number from the member table and a list of first_name and last_name columns from the contact table in a JSON structure.

One of my students asked why I choose to strip the backslashes with Python, and my reply was the SQL was already complex for most blog readers. The student asked but how would you do it in SQL. OK, that’s a fair question for two reasons. First, you don’t need to do in your local programs because it’ll run faster on the server. Second, if you strip the backslashes you can insert it into a standard JSON column. This blog post will show you how to do both.

You would use three REGEXP_REPLACE function calls, like:

[Read more]
Find All Table’s Current AUTO_INCREMENT Value

I recently wanted to check all tables’ current AUTO_INCREMENT value (if any) for a database dump structure. I wasn’t sure if a tables’ Data Definition Language (DDL) statement contained the current AUTO_INCREMENT value or not. So after I loaded the dump file, I learned of a query to use and find out…

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 OpenLampTech newsletter.

Image by  …

[Read more]
OpenLampTech issue #31 – Substack Repost

I could barely stuff this week’s OpenLampTech issue #31 into the email client to send out. It is that full!

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 OpenLampTech newsletter.

In this week’s OpenLampTech issue #31, we are covering articles on:

  • Drupal PWAs
  • What is a WordPress Developer?
  • PHP OOP concepts and definitions
  • WordPress contact form plugin
  • 7 pieces of Linux advice
  • And much, much more.

Original and curated content. PHP, MySQL, and the LAMP stack. All in one place. Every week. …

[Read more]
MySQL WHERE Clause Equality Comparison Operator

We don’t always need all rows from the table as part of the final results set. You can use one (or more) of the comparison operators to filter the rows with a WHERE clause conditional. In this post, we are looking at the equality comparison operator (=)…

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 OpenLampTech newsletter.

Image by kalhh from  …

[Read more]
OpenLampTech issue #30 – Substack Repost

I’m back again this week with your MySQL, PHP, and LAMP stack media outlet source. There are plenty of great reads in this week’s OpenLampTech newsletter. Enjoy and please share the publication.

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 OpenLampTech newsletter.

There is something for everyone in OpenLampTech issue #30. We have articles covering:

  • 20 Laravel tips
  • Ignore FSE
  • Sorting arrays in PHP
  • Linux useradd and adduser commands
  • SQL engineering guide
  • And much much more…

Don’t …

[Read more]
Is SQL Programming


Is SQL, or Structured Query Language, a programming language? That’s a great question! A question that many answer with emphasis: “No, SQL is not a programming language!” There are some who answer yes; and they usually qualify that answer with something like: “SQL is a programming language designed to communicate with relational databases.”

It strikes me that those saying “yes” are saying that SQL is only a collection of interface methods to read from and write to a database engine. Those saying SQL is not a programming language often qualify that a programming language must have conditional logic and iterative structures, which don’t exist in SQL.

There’s a third group that are fence sitters. They decline to say whether SQL is a programming language, but they also say individuals who only write SQL aren’t programmers. That’s a bit harsh from my perspective.

Before …

[Read more]
Node.js MySQL Error

While I blogged about how to setup Node.js and MySQL almost two years ago, it was interesting when a student ran into a problem. The student said they’d configured the environment but were unable to use Node.js to access MySQL.

The error is caused by this import statement:

const mysql = require('mysql') 

The student got the following error, which simply says that they hadn’t installed the Node.js package for MySQL driver.

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'mysql'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object. (/home/student/Data/cit325/oracle-s/lib/Oracle12cPLSQLCode/Introduction/query.js:4:15)
    at Module._compile …
[Read more]
MySQL DATE() Function with examples

The MySQL DATE() function is a built-in function you use to extract just the date portion from a DATE or DATETIME value. Learn how to use the DATE() function in this blog post…

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 OpenLampTech newsletter.

Image by MaeM from Pixabay

MySQL DATE() Function Syntax

The …

[Read more]
OpenLampTech issue #29 – Substack Repost

The OpenLampTech newsletter is going to the next level with more content than you can imagine so stay tuned! Enjoy this week’s newsletter and share this edition. Thank you for reading the publication!

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 OpenLampTech newsletter.

Get ready for great MySQL, PHP, and LAMP stack content. In this week’s OpenLampTech issue #29 newsletter we have articles on:

  • The Linux passwd file
  • 5 PHP tips to write better code
  • Another top-notch video on WordPress Full Site Editing
  • 17 Laravel performance tips …
[Read more]
Showing entries 51 to 60 of 980
« 10 Newer Entries | 10 Older Entries »