Wherever you are, and how ever you're celebrating, I hope you have a happy and safe New Years Eve!
Thursday, December 31, 2020
Wednesday, December 30, 2020
mySQL: Sample Databases
How do I load customer agnostic sample databases into mySQL?
The issue with demos and/or general purpose query learning is that it requires data. Sometimes, different types of data.
For example, for general purpose query learning, the enron dataset is amazing. Especially for windowing functions, too, where having a large number of rows in a single table is what you want. I found it here:
http://www.ahschulz.de/enron-email-data/
However, for other purposes, especially those with more of a business flavor such as aggregates and groups, something like the Northwind database is ideal.
The GitHub user jpwhite has published the Northwind sample database as a set of mySQL scripts.
https://github.com/jpwhite3/northwind-MySQL
Tuesday, December 29, 2020
mySQL: Basic aggregates from a table
In mySQL, how do I get the basic aggregates from a table?
| mySQL | Explanation | SQL Server |
|
use enron; select COUNT(*) as counted from recipientinfo; select MIN(rid) as rid_min from recipientinfo; select MAX(rid) as rid_max from recipientinfo; select SUM(rid/10.0) as rid_summed from recipientinfo; select AVG(rid/10.0) as rid_avgd from recipientinfo; |
No real surprises here - they work the same in both places. |
use Enron; go select COUNT(*) as counted from dbo.recipientinfo; select MIN(rid) as rid_min from dbo.recipientinfo; select MAX(rid) as rid_max from dbo.recipientinfo; select SUM(rid/10.0) as rid_summed from dbo.recipientinfo; select AVG(rid/10.0) as rid_avgd from dbo.recipientinfo; |
Monday, December 28, 2020
mySQL: How do I find the number of rows in my table
How do I find the number of rows in my table?
In mySQL:
select count(*) from enron.message;
or
show table status;
SQL Server:
use enron;
go
select count(*) from dbo.message;
or
use enron;
go
select * from sys.partitions where object_id = OBJECT_ID('dbo.message');
Friday, December 25, 2020
Merry Christmas!
It's Christmas - on a Friday :)
Merry Christmas. I hope you and your family are safe and healthy at this time of year.
Especially this year.