We clearly need a term for a collection of SQL User-Defined functions. I am proposing that from hereinafter we refer to collections of SQL Functions and Procedures as “SQL Packages”. Of course SQL has a “package object” but that’s more of an internally ge…

We clearly need a term for a collection of SQL User-Defined functions. I am proposing that from hereinafter we refer to collections of SQL Functions and Procedures as “SQL Packages”. Of course SQL has a “package object” but that’s more of an internally ge…lnkd.in/ggB8b86H

– SQL iQuery for #IBMi (aka Q38) (@sqliquery)05:49 – Jan 25, 2023

The Four Hundred, January 25, 2023 – – #N2i Gains Traction Among #IBMi Newbies; Realizing The Promise Of Cross Platform Development With #VSCode; #2023 IBM i Predictions, Part 3; #400Monitor; Join The 2023 IBM i Marketplace Survey Webinar Tomorrow

The Four Hundred, January 25, 2023 – mailchi.mp/itjungle/the-f…#N2i Gains Traction Among #IBMi Newbies; Realizing The Promise Of Cross Platform Development With #VSCode; #2023 IBM i Predictions, Part 3; #400Monitor; Join The 2023 IBM i Marketplace Survey Webinar Tomorrow

– IT Jungle (@ITJungleNews)04:00 – Jan 25, 2023

Over One Quarter of Organizations Have No Plans to Implement Cybersecurity Measures Despite Cybersecurity Remaining Top Concern

Notifications

Older

Breaking News • Jan 25, 2023

Stocks rally back from deep lows, finish mixed as more earnings roll in

Breaking News • Jan 25, 2023

Sticks sink at open after downbeat forecast from Microsoft, before more earnings roll in

Morning Brief • Jan 25, 2023

Layoffs in Corporate America are spreading from tech to conglomerates

News • Jan 24, 2023

Justice Department sues Google to break up its advertising empire

Breaking News • Jan 24, 2023

Stocks fall as rally loses steam, more corporate earnings trickle in

Morning Brief • Jan 24, 2023

‘It just didn’t seem like the right year to be celebrating’: A final dispatch from Davos 2023

Breaking News • Jan 23, 2023

Nasdaq jumps 2% as stocks rally to start key earnings week

Breaking News • Jan 23, 2023

Stocks nudge higher at open as investors head into big earnings week

Morning Brief • Jan 23, 2023

What investors need to hear from Tesla this week

Breaking News • Jan 20, 2023

Nasdaq jumps 2.7% as tech leads Friday stock rally

News • Jan 20, 2023

We talked to top CEOs at the World Economic Forum in Davos. Here’s what they’re saying about a recession.

Breaking News • Jan 20, 2023

Stocks waver at open as Wall Street looks to rebound from down sessions

Morning Brief • Jan 20, 2023

Earnings estimates keep falling. That might not be a problem for stocks.

News • Jan 20, 2023

Google parent to lay off 12,000 workers in latest blow to tech sector

News • Jan 19, 2023

Netflix CEO Reed Hastings steps down, COO Greg Peters to take co-CEO role

Breaking News • Jan 19, 2023

Stocks extend losses as Wall Street digests earnings, data, Fedspeak

News • Jan 19, 2023

Mortgage rates fell for third straight week. Rates have declined over three-quarters of a point since November.

Breaking News • Jan 19, 2023

Stocks fall at open, pointing to another day of losses

Morning Brief • Jan 19, 2023

The 2023 investment narrative is already diverging from 2022

Breaking News • Jan 18, 2023

Stocks plunge in first major wipeout of 2023

Breaking News • Jan 18, 2023

Stocks inch higher at open as earnings season picks up, data rolls in

News • Jan 18, 2023

Microsoft to cut 10,000 jobs as PC sales, cloud growth decline

Morning Brief • Jan 18, 2023

One chart explains why 2022 was so grim for Wall Street bankers

Breaking News • Jan 17, 2023

Dow sinks after big banks report profit drops; Goldman slides 7% after largest earnings miss in decade

Morning Brief • Jan 17, 2023

Half a world away, big tech is in a world of its own

News • Jan 15, 2023

Netflix results, retail sales, Davos: What to know this week

Morning Brief • Jan 14, 2023

Big banks set aside $4 billion for a recession. Investors are more optimistic

Breaking News • Jan 13, 2023

Stocks edge higher, S&P 500 and Nasdaq notch biggest weekly gains in 2 months

Breaking News • Jan 13, 2023

Stocks fall at open, bank stocks sink after earnings reports

Morning Brief • Jan 13, 2023

For the Fed, ‘3% is the new 2%’

Breaking News • Jan 12, 2023

Stocks edge higher after more upbeat inflation data

News • Jan 12, 2023

‘A very favorable’ but ‘underwhelming’ report: Wall Street splits on the implications of December CPI report

Breaking News • Jan 12, 2023

Stocks wobble at open as investors digest inflation data

Breaking News • Jan 12, 2023

Inflation rose 6.5% over last year in December, capping historic year of price increases

Morning Brief • Jan 12, 2023

Inflation will surprise investors again in 2023

Breaking News • Jan 11, 2023

Stocks extend gains as all eyes turn to CPI report on Thursday

Breaking News • Jan 11, 2023

Stocks rise at open as investors await inflation data, bank earnings later this week

Morning Brief • Jan 11, 2023

Why Coinbase’s latest layoffs feel bigger than they are

News • Jan 11, 2023

Key FAA computer system fails, flights grounded

Breaking News • Jan 10, 2023

Stocks chug forward as Wall Street looks to Powell, Fed members for rate clues

Breaking News • Jan 10, 2023

Stocks rise at open as investors weigh Fedspeak, mull live comments from Powell speech

Morning Brief • Jan 10, 2023

It’s time for investors to ‘be more realistic’ about downbeat earnings

Breaking News • Jan 09, 2023

Nasdaq adds to last week’s gains while Dow, S&P 500 fall in choppy session

Breaking News • Jan 09, 2023

Stocks open higher Monday, continuing early-year rally

Morning Brief • Jan 09, 2023

Macy’s quietly lays an egg — and more may be coming for retail

Morning Brief • Jan 07, 2023

The economic outlook is complicated. The most important figure of 2022 is not

U.S. markets open in 8 hours 57 minutes

Survey Also Highlights a Continued Shortage of Security Knowledge and Skills, But Reveals a Promising Outlook for Power10

MINNEAPOLIS, Jan. 26, 2023 /PRNewswire-PRWeb/ — Cybersecurity software and services provider Fortra today published findings from its 2023 IBM i Marketplace Survey. Now in its ninth year, the survey reveals the trends shaping and driving the global IBM i market. In this year’s survey, 68% of respondents said the ongoing cybersecurity threat remains their number one concern, up from 62% last year, yet 27% do not plan to implement cybersecurity measures such as encryption, multi-factor authentication, antivirus, or ransomware protection to help address this growing concern.

“Organizations that neglect to prioritize these security controls risk being brought to their knees by data breaches, ransomware, or other cyber attacks that prey on security vulnerabilities,” said Tom Huntington, Executive Vice President of Technical Solutions at Fortra. “If your organization has no plans to address these risks, we strongly urge you to rethink your approach.”

In addition to continued concerns about cybersecurity, 48% of respondents said a lack of security knowledge and skills topped the list of the challenges organizations face. “The ongoing shortage of IT skills has hit the IBM i community hard, and we are seeing a rise in demand for managed security services to help bridge this gap,” continues Huntington.

Businesses have begun their journey to Power10.

This year’s survey also reveals a high level of satisfaction for the platform, with 95% stating IBM i delivers a great return on their investment. While only 16% of respondents said they have already migrated or are in the process of upgrading to Power10, 74% are strongly considering it.

“There’s no surprise that organizations are beginning to adopt servers running the Power10 processor, as we know there are tangible benefits to new hardware around security, virtualization, and high availability,” concluded Huntington.

To access the complete 2023 IBM i Marketplace Survey results, visit: https://www.fortra.com/resources/guides/ibm-i-marketplace-survey-results.

-end-

Notes to Editors

Methodology and Demographics
This survey represents the viewpoints of 300 IBM i professionals from around the globe across multiple industries and regions. This diverse sampling spans variability in budgets, company size, server size, operating system versions, and experience levels to give a representative and diverse look at the worldwide IBM i market.

This year saw a balance between respondents from smaller organizations (less than 500 employees) and those coming from bigger ones (51% vs 49% respectively). In terms of the job titles of respondents, they are mostly cybersecurity professionals, IT managers, developers, and administrators, while under the “Other” option you may find titles like account manager, architect, and engineer.

Additionally, we saw an uptick in the number of respondents from Europe. Manufacturing and banking/finance are the top industries of our respondents this year.

About Fortra
Fortra is a cybersecurity company like no other. We’re creating a simpler, stronger future for our customers. Our trusted experts and portfolio of integrated, scalable solutions bring balance and control to organizations around the world. We’re the positive changemakers and your relentless ally to provide peace of mind through every step of your cybersecurity journey. Learn more at fortra.com.

©Fortra, LLC and its group of companies. All trademarks and registered trademarks are the property of their respective owners.

Media Contact

Angela Tuzzo, MikeWorldWide, 732-758-1100, [email protected]

Dinara Omarova, Touchdown PR, +44 (0) 7887 490041, [email protected]

SOURCE Fortra

AdMust-See Girls You Could Date

Exclusive Dating Club: High Quality Matches

AdNeed tips for taming the bear market in 2023?

Equip yourself with the right tools, knowledge, and insights for weathering the recession and create a potential income stream.

2 Stocks Warren Buffett Should Buy in 2023

According to the latest available information, Berkshire Hathaway (NYSE: BRK.A)(NYSE: BRK.B) had about $109 billion in cash and equivalents on its balance sheet. CEO Warren Buffett insists on keeping a $30 billion cash cushion at all times, but this still leaves nearly $80 billion of investable capital. For one thing, Berkshire has already spent tens of billions in the recent market downturn.

Las Vegas Strip Casinos Have an Unexpected Problem (You Should Be Mad)

Caesars Entertainment , Wynn Resorts , and MGM Resorts International — face a class action lawsuit that alleges that they worked to artificially increase room prices. Hagens Berman has filed a class action lawsuit that charges that Caesars, MGM, Wynn, and Treasure Island colluded with a third party, Rainmaker, to collude to raise hotel prices on the Las Vegas Strip.

Ad20 Actors With Martial Arts Skills

This list covers actors and celebs that are actually skilled in one or more martial arts disciplines, and some of the entries may surprise you…

AdFind Your Mature Soulmate

Safe, Secure Dating for Mature Singles. Build Connections & Find Love. Chat Now

How Much Income Can I Have Before My Social Security Benefits Decrease?

If someone receiving Social Security benefits earns money by working, the Social Security Administration may reduce the amount of that person’s benefits. This only affects people who start taking benefits before reaching full retirement age. And only income earned from … Continue reading → The post What Income Reduces Social Security Benefits? appeared first on SmartAsset Blog.

AdPictures You Won’t Believe Were Actually Taken

These captivating photographs capture the unexpected scale of things in the physical world and elsewhere

AdPour Salt Down Your Drain At Night, Here’s Why

If you aren’t doing this a couple times a week, you need to start. Grab your salt and pour some directly down your drain at night. In the morning….

How Can I Reduce My RMDs?

Individual Retirement Accounts (IRAs), 401(k)s and other workplace plans can help you build wealth for the future while enjoying some tax benefits. There’s just one important thing you need to plan for: required minimum distributions (RMDs). The IRS requires you … Continue reading → The post 6 Strategies to Reduce Your RMDs appeared first on SmartAsset Blog.

For automakers, the EV surge is everything everywhere all at once

The surprise leadership shuffle on Thursday at Toyota Motor Corp, renewed urgency at Renault and Nissan Motor Co to restructure their alliance and Elon Musk’s declaration that Tesla Inc will be the world’s No. 1 automaker by a wide margin have one thing in common: What once defined the global auto industry’s center is no longer holding. The announcement that Akio Toyoda will step down as chief executive of the world’s top-selling automaker on April 1 came just hours after Musk used a quarterly earnings call to declare that Tesla was now the auto industry’s leader in profitability and manufacturing efficiency – the crown Toyota held for three decades. Toyota’s incoming CEO, Koji Sato, faces a daunting task.

Comment on Using ChatGPT to Write SQL by Ember Crooks

Working in technology, I’ve heard a number of things about ChatGPT from various news sources.

I was particularly interested hearing some teachers saying it was the end of being able to properly detect students cheating when writing papers. Then I heard a teacher talking about how this was the new ‘calculator’ that teachers need to learn how to leverage in their curriculums. Some talented developers at work were also talking about ways to use ChatGPT to write code and sharing experiences they’ve had with it.

Then a colleague mentioned that ChatGPT can write valid SQL, and I could hardly wait to try it.

The Challenge

At work, I’ve been playing around with some of MySQL’s unusual ways of handling GROUP BY, and I thought I would use the SQL I’ve been toying with there to experiment with ChatGPT.

The SQL I’m playing with is using the Sakila database. I’m using the rental table to demonstrate some of the unexpected behavior I get in MySQL with ONLY_FULL_GROUP_BY mode disabled. The results can be unexpected when I include a column in the SELECT clause that neither has an aggregate function specified, nor is one of the columns I’m grouping on. For reference, Db2 will simply fail and require that every column either have an aggregation function or be included in the GROUP BY clause. MySQL behaves that way only when ONLY_FULL_GROUP_BY is enabled.

Note that I’m using the sakila database in a docker container for this, if you want to try any of the SQL.

The SQL I’m using is designed to display some of the surprising behavior MySQL has in this area. The goal is to list the name and rental date of the last film a user rented, using the Sakila database. This is the SQL that I wrote to display what someone might think works, but it drastically doesn’t:

select inventory_id, customer_id, max(rental_date)
from rental
where `customer_id`=1
group by customer_id
limit 1;
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘sakila.rental.inventory_id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

In this case, this SQL fails entirely as it would on Db2 because the mode ONLY_FULL_GROUP_BY is in use (which is the default). It fails because we include inventory_id in the SELECT list without either specifying it in the GROUP BY or specifying an aggregate function for it.

If I run this in an environment that isn’t using the mode ONLY_FULL_GROUP_BY, I get something like this:

+————–+————-+—————————-+
| inventory_id | customer_id | max(rental_date) |
+————–+————-+—————————-+
| 4020 | 1 | 2005-08-22 19:41:37.000000 |
+————–+————-+—————————-+

Note that I get an answer, and while that rental date is correct, the inventory_id is not. In this case, MySQL chooses any value from the column (often the first) and uses it. The value it chooses is not deterministic, and may vary.

This is SQL that actually works in 5.7, even without ONLY_FULL_GROUP_BY, to get a correct answer:

select inventory_id, customer_id, rental_date
from rental a
where rental_date=( select max(rental_date) from rental b where a.customer_id=b.customer_id and staff_id=1) and a.customer_id=1;
+————–+————-+———————+
| inventory_id | customer_id | rental_date |
+————–+————-+———————+
| 1446 | 1 | 2005-08-22 19:41:37 |
+————–+————-+———————+
1 row in set (0.00 sec)

This is a correct answer to the question, though I’m eliminating joins so I can use the query for demonstrating the very specific point I’m trying to illustrate. A full answer to the question is:

select title, customer_id, rental_date
from rental a join inventory i on a.inventory_id=i.inventory_id
join film f on f.film_id=i.film_id
where rental_date=( select max(rental_date) from rental b where a.customer_id=b.customer_id and staff_id=1)
and a.customer_id=1
and staff_id=1;
+———————–+————-+———————+
| title | customer_id | rental_date |
+———————–+————-+———————+
| FIREBALL PHILADELPHIA | 1 | 2005-08-22 19:41:37 |
+———————–+————-+———————+
1 row in set (0.01 sec)

Enter ChatGPT

Now keep in mind that I’ve never even played with ChatGPT before. I thought I’d just try it. I entered this prompt:

Can you write a valid SQL statement for MySQL 5.7 that uses the Sakila database to find the name of the latest movie that customer id 1 rented from employee id 1?

And here is the result:

I figured my starting try would be too simple, that I’d have to refine and maybe provide data model details. Nope, that’s a correct answer from where I started:

SELECT film.title
FROM rental
JOIN inventory ON rental.inventory_id = inventory.inventory_id
JOIN film ON inventory.film_id = film.film_id
WHERE rental.customer_id = 1 AND rental.staff_id = 1
ORDER BY rental.rental_date DESC
LIMIT 1;
+———————–+
| title |
+———————–+
| FIREBALL PHILADELPHIA |
+———————–+
1 row in set (0.09 sec)

I am really impressed that it not only wrote a correct SQL statement, and knew the Sakila data model, but that it both did not make mistakes I’ve seen humans make, and also gave me the code in monospaced, easy to copy text.

I started with a simplified version of the query, and ChatGPT gave me a correct answer, but writing this for one customer for me is just a precursor to writing it for multiple customers, and that’s why I chose the correlated subquery method of solving it (well that, and neither CTEs nor window functions work in MySQL 5.7). Let me try to get Chat GPT to write the more complicated form of the query:

It’s a correct answer. Not only that, I’ve never seen that particular formatting for join syntax –

FROM
customer c
JOIN
rental r ON c.customer_id = r.customer_id

It really calls out the table names, and I love it. The only criticism I could come up with is that it did not enclose identifiers in tick marks, but I’m pretty inconsistent on that myself.

Finally, I wondered if the SQL would change if I specified MySQL 8, because if I were writing this query for MySQL 8, I would use a CTE. And dang it, ChatGPT is right there with me:

More Challenges for ChatGPT

I’m impressed. I expected minor problems, and having to give hints, including having to specify more about the data model. I don’t know that it’s a tool I would use myself to write SQL. I do think that there are limitations to ChatGPT, and some of those are human. Humans aren’t always great at formatting a request properly or frankly even at knowing what they want. I want to experiment more!

I get the impression that many responses to ChatGPT results are “Well, that’s not wrong”, so I decided to ask it to write a whole blog entry for me. I can see several areas I would cover differently, but most of what it has there is not wrong. Here’s the prompt I gave it:

please write a blog entry of 500 words or more in the style of https://datageek.blog describing the pitfalls of not using ONLY_FULL_GROUP_BY with MySQL and how it can lead to unexpected query results.

And here’s what it came up with:

As a data geek, one of the most important things to understand when working with SQL databases is the concept of a “group by” clause. The group by clause is used to aggregate data, allowing you to perform calculations on multiple rows of data and return a single result. For example, you might use the group by clause to calculate the average salary of all employees in a specific department.

But what happens when you’re working with a MySQL database and you forget to include the “ONLY_FULL_GROUP_BY” mode? The answer is that you may end up with unexpected query results.

The ONLY_FULL_GROUP_BY mode is a MySQL setting that enforces the SQL standard for the group by clause. When this mode is enabled, the query must include all non-aggregated columns in the group by clause. This means that if you’re trying to group data by a specific column, you must also include that column in the group by clause.

For example, let’s say you have a table called “employees” that contains the following columns: “employee_id”, “first_name”, “last_name”, and “salary”. If you want to group the data by the “last_name” column, your query should look something like this:

SELECT last_name, AVG(salary)
FROM employees
GROUP BY last_name;

If you forget to include the “last_name” column in the group by clause, you’ll get unexpected results. Instead of calculating the average salary for each last name, you’ll get an average salary for the entire table.

But the problem is not only the query but also the default mode of MySQL, before version 8.0, that is set to not enable this mode by default. This means that if you’re working with an older version of MySQL, you might not even realize that you’re not including all non-aggregated columns in the group by clause. And this can lead to unexpected results.

Another pitfall is when you’re trying to select non-aggregated columns that are not included in the group by clause. In this case, MySQL will return an arbitrary value for that column. This can lead to even more confusion and unexpected results.

So, how can you avoid these pitfalls? The first step is to make sure that you have the ONLY_FULL_GROUP_BY mode enabled. You can do this by adding the following line to your MySQL configuration file:

sql_mode = ‘ONLY_FULL_GROUP_BY’

If you are using version 8.0 or later, this mode is enabled by default.

The second step is to be mindful of the columns that you’re including in your group by clause. Make sure that you’re including all non-aggregated columns, and be aware of the potential pitfalls of selecting non-aggregated columns that are not included in the group by clause.

In conclusion, the group by clause is a powerful tool for aggregating data in MySQL. However, it’s important to understand the potential pitfalls of not using the ONLY_FULL_GROUP_BY mode. By enabling this mode and being mindful of the columns that you’re including in your group by clause, you can avoid unexpected results and ensure that your queries are returning accurate data.

Not bad. I’d like to think it’s not as good as I’d do, but you’ll have to wait for me to finish writing my version of that one to see!

Are you using or experimenting with ChatGPT at all? Share your experiences in the comments below, or with me on Mastodon – I’m @[email protected].

Ember is always curious and thrives on change. She has built internationally recognized expertise in IBM Db2, and is now pivoting to focus on learning MySQL. Ember shares both posts about her core skill set and her journey learning MySQL.

Ember lives in Denver and work from home

Verified by MonsterInsights