Windowing functions are a critical tool for grouping rows of data that are related to other rows. But they go far beyond the regular aggregate functions found in MySQL 5.7 and earlier. In MySQL 8 you do not have to collapse all the information down into a single output row. Each row can retain its individual identity but the server can analyze the data as a unit.
Statistics and Damned Lies Finding the total Population of the District Texas from the world.city table is simple.
SQL> select District, sum(Population)
from city where district = 'Texas';
| District | sum(Population) |
| Texas | 9208281 |
1 row in set (0.0068 sec)
There was an interesting but hard to read post on StackOverflow about how 'insert select delete'
data from a MySQL JSON data type column. The first line of
the writer's problem is a little confusing '
In order to record user mac_address and count mac_address to restrict user login's pc or notebook to control user available max for example (it's work)' but the examples reveled more about what was desired. The idea was to track MAC address used by various users and the author of the question was wondering how to up data a JSON Array of values with JSON_INSERT. INSERT is for inserting and the better choice would be JSON_ARRAY_APPEND or JSON_ARRAY_INSERT. But what caught my eye was the second question: Select sql command for json column ? could be …
Occasionally at conference or a Meetup, someone will approach me
and ask me for help with a MySQL problem. Eight out of ten
times their difficulty includes a sub query. "I get an error
message about a corrugated or conflabugated sub query or some
such," they say, desperate for help. Usually with a
bit of fumbling we can get their problem solved. The
problem is not a lack of knowledge for either of us but that sub
queries are often hard to write.
MySQL 8 will be the first version of the most popular database on the web with Common Table Expressions or CTEs. CTEs are a way to create temporary tables and then use that temporary table for queries. Think of them as easy to write sub queries!
WITH is The Magic WordThe new CTE magic is indicated with the WITH clause.
mysql> WITH myfirstCTE[Read more]
AS (SELECT * FROM world.city WHERE …
The VideoThe find() function for the MySQL Document Store is a very powerful tool and I have just finished a handy introductory video. By the way -- please let me have feed back on the pace, the background music, the CGI special effects (kidding!), and the amount of the content. The ScriptFor those who want to follow along with the videos, the core examples are below. The first step is to connect to a MySQL server to talk to the world_x schema (Instructions on loading that schema at the first link above).
db is an object to points to the world_x schema. To find the records in the countryinfo collection, use db.countryinfo.find(). But that returns 237 JSON documents, too many! So lets cut it down to …[Read more]
The MySQL Document Store functionality allows developers to use a relation database with or without SQL (structured Query Language), also known as NoSQL. The example in this blog is hopefully a simple look at this new feature of MySQL. The example data used is from JSONStudio.com and is a JSON formatted data set for US zip (postal) codes (656K compressed). So download your copy of this data set and lets get to work.
Create a collectionCollections are tables and below we create a collection name 'zip' in the test database in the Python dialect.
mysqlsh -u root -p --py test
Creating an X Session to root@localhost:33060/test
Default schema `test` accessible through db.
Welcome to MySQL Shell 1.0.4 Development Preview
Copyright (c) 2016, Oracle and/or its affiliates. …
Is it cheating? Is using MySQL without Structured Query Language (SQL) or putting all your data into one column proper? Impossible a year ago and probably thought as a poor/crazy practice until recently, this is a new type of MySQL usage. NoSQL has had a big impact in the SQL world with several relational products from vendors like MySQL, Microsoft, Postgresql and others offering NoSQL interfaces and JSON data types to their databases.
Several old timers have come to me asking if putting lots of data in a JSON column is cheating? After all data normalization is part of relational databases and the way to efficiency and speed is well organized data. This higgledy–piggledy fashion of putting an entire document in a column without breaking it down to its component sections does violate the first rule of data normalization. And that has …[Read more]
MySQL 5.7 introduced many new facets to password security. The first thing most notice is that you are assigned a random root password at installation time. You then have to search the log file for this random password, use it to login, and then change it. For the examples on the post I am using a fresh install of 5.7.13 on Oracle Linux 7.1 and was provided with the easy to remember password of nLvQRk7wq-NY which to me looked like I forgot to hit escape when trying to get out of vim. A quick ALTER USER to change the password and you are on your way. Defaults Password Lifetime and Complexity5.7.13 now has the default password lifetime set to 0 or 'never expire'. My fresh install shows that the value of mysql.user.password_lifetime is set to NULL which …[Read more]
The MySQL Document Store introduced with version 5.7.12 allows developers to create document collections without have to know Structured Query Language. The new feature also comes with a new set of terminology. So let us create a collection and see what it in it (basically creating a table for us SQL speakin' old timers).
What did the server do for us? Switching to SQL mode, we can use describe to see what the server has done for us.
We have a two column …[Read more]
We’ve released Drizzle7! Not only that, we’re now calling it Generally Available – a GA release.
What does this mean? What does this GA label mean?
You could view as a GA label being “we’re pretty confident people aren’t going to on mass ask for our heads when they start using it”… which isn’t a too bad description. We also plan to maintain it, there could be future releases in this series that just include bug fixes – we won’t just immediately tell you to go and use the latest tarball or bzr tree. This release series is a good one to use.
Drizzle7 is something that can be packaged in Linux distros. It’s no longer something where the best bet is to add the PPA and upgrade every two weeks or build …[Read more]
There are signals of continued problems and dysfunction — namely lack of support, organization and communication — in the OpenSolaris community. This follows on a deterioration of the OS leadership and support since Oracle bought Sun Microsystems, including the elimination of OpenSolaris CDs, one of the things that made the open source version of Solaris more like Linux.
We had speculated on the fate of Sun open source software under Oracle and while we acknowledged Oracle’s participation in, contribution and commitment to and opportunity from open source software, we …[Read more]