Showing entries 1 to 10 of 1183
10 Older Entries »
Displaying posts with tag: sql (reset)
SQL Statement Management

It’s very difficult explaining to students new to relational databases how SQL works. There are many parts that seem intuitive and then there are others that confuse and confound.

For beginners, the idea that a SQL statement is simply a text string that you must dispatch to a SQL statement processing engine is new. That’s because they use an Integrated Development Environment (IDE) that hides, or abstracts the complexity, of how SQL executes.

I start my core SQL class by demonstrating how to run a text literal query without a FROM clause in MySQL Workbench, like this:

SELECT 'Hello World!' AS "Output";

After writing the query, I highlight everything except the semicolon and click the lightening bolt that dispatches the static string to the SQL statement engine. They see this result:

Then, I launch a mysql Monitor session and write the query with a semicolon to dispatch the SQL …

[Read more]
High-Performance Java Persistence Newsletter, Issue 65

Introduction Welcome to a new issue of the High-Performance Java Persistence Newsletter in which we share articles, videos, workshops, and StackOverflow answers that are very relevant to any developer who interacts with a database system using Java. Articles The pick of this week is this article about various online schema migration options that are available in MySQL. Another great read was this one about scaling the One Million Checkboxes website. There are many lessons you can learn from this experiment. One lesson is about the cost of running a high-traffic website. Using... Read More

The post High-Performance Java Persistence Newsletter, Issue 65 appeared first on …

[Read more]
Observing InnoDB Cluster: A different approach for specific info extraction

Now this is far from being any observability manual for your InnoDB Cluster and let alone go into everything MySQL Shell API Admin, or the collectDiagnostics utility. You can also use the default javascript commands that we all know and love via dba.getCluster() and so on, but here’s a different take.

I just want to share something I’ve been playing with to pull out some key info from mycluster. Hope it helps someone else out there.

General setup:

select cluster_id, cluster_name, description, cluster_type, primary_mode, clusterset_id
from mysql_innodb_cluster_metadata.clusters;

Members of our cluster:

select * from …
[Read more]
Parametric Queries

In 2021, I wrote a MySQL example for my class on the usefulness of Common Table Expressions (CTEs). When discussing the original post, I would comment on how you could extend the last example to build a parametric reporting table.

Somebody finally asked for a concrete example. So, this explains how to build a sample MySQL parametric query by leveraging a filter cross join and tests the parameter use with a Python script.

You can build this in any database you prefer but I used a studentdb database with the sakila sample database installed. I’ve granted privileges to both databases to the student user. The following SQL is required for the example:

-- Conditionally drop the levels table.
DROP TABLE IF EXISTS levels;
 
-- Create the levels list.
CREATE TABLE levels
( level_id       int unsigned primary key auto_increment
, …
[Read more]
Workaround for MySQL’s “can’t specify target table for update in FROM clause” Error

In MySQL, you cannot do this: create table t (i int primary key, j int); insert into t values (1, 1); update t set j = (select max(j) from t) + 1; The UPDATE statement will raise an error as follows: SQL Error [1093] [HY000]: You can't specify target table 't' for update in FROM … Continue reading Workaround for MySQL’s “can’t specify target table for update in FROM clause” Error →

Newsletter Repost – OpenLampTech issue #109

WooCommerce block product editor | Escaping output in PHP and Laravel | SQL must go | GitHub and MySQL v8. OpenLampTech is a media and content source for PHP, MySQL, and the LAMP stack.

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.

Thank you for reading this post. Please share it with someone else who would enjoy it as well.

Josh Otwell has a passion to grow as a PHP Developer, SQL expert, and technical blogger/writer.

Disclaimer: The majority of examples in this post, are performed in a personal development/learning …

[Read more]
Index Selectivity

Introduction In this article, we are going to see how Index Selectivity works in relational database systems and why the database Optimizer might choose to avoid using an index if the number of matching records is large. Index selectivity is inversely proportional to the number of index entries matched by a given value. So, a unique index has the highest selectivity because only a single entry can be matched by any given value. On the other hand, if column values are skewed, then a column value matching a large number of table... Read More

The post Index Selectivity appeared first on Vlad Mihalcea.

SQL 1 v.s. SQL 3

In Alan Beaulieu’s wonderful book Learning SQL: Generate, Manipulate, and Retrieve Data, he uses a SQL 1 to demonstrates a CROSS JOIN in MySQL counting from 1 to 100. My students always find it difficult to read because the subqueries take so much space it makes it difficult to see the process, for example he gives this SQL 1 solution:

SELECT ones.x + tens.x + 1 AS counter
FROM
 (SELECT 0 AS x UNION ALL
  SELECT 1 AS x UNION ALL
  SELECT 2 AS x UNION ALL
  SELECT 3 AS x UNION ALL
  SELECT 4 AS x UNION ALL
  SELECT 5 AS x UNION ALL
  SELECT 6 AS x UNION ALL
  SELECT 7 AS x UNION ALL
  SELECT 8 AS x UNION ALL
  SELECT 9 AS x ) ones CROSS JOIN
 (SELECT 0 AS x UNION ALL
  SELECT 10 AS x UNION ALL
  SELECT 20 AS x UNION ALL
  SELECT 30 AS x UNION ALL
  SELECT 40 AS x UNION ALL
  SELECT 50 AS x UNION ALL
  SELECT 60 AS x UNION ALL
  SELECT 70 AS x UNION ALL
  SELECT 80 AS x UNION ALL
  SELECT 90 AS x ) tens
ORDER BY counter;

While anybody with a …

[Read more]
5 Websites To Learn More SQL – Substack Repost

SQL is foundational in web and application programming. There are many websites and resources online to learn SQL. I like these 5 websites and think you will too…

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.

Read the article: 5 Websites To Learn More SQL

Support the OpenLampTech publication with your free subscription. Thank you!

Thank you for reading this post. Please share it …

[Read more]
CodeIgniter 4 Database Features Overview in 2022 – Substack Repost

CodeIgniter 4 is a solid, well-designed PHP framework and one I enjoy using and exploring every chance I get. In 2022, the CodeIgniter 4 team released many database-related upgrades. Learn more about the ones I found most significant in this OpenLampTech report.

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.

Head over to the OpenLampTech publication page and read more on this CodeIgniter 4 piece.

Want to support the OpenLampTech publication? …

[Read more]
Showing entries 1 to 10 of 1183
10 Older Entries »