タグ

関連タグで絞り込む (1)

タグの絞り込みを解除

sqlとmysqlに関するaiueo010101のブックマーク (4)

  • MySQLでクロス集計してみた【1/2】

    マスタテーブルつくって説明すると面倒くさいので、直接商品名、色名をインサートするとし、テーブルを以下のように作っておく。 CREATE TABLE IF NOT EXISTS `history` ( `id` int(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `color` varchar(255) NOT NULL, `price` int(10) unsigned NOT NULL, `created` datetime NOT NULL, `modified` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `name` (`name`,`price`,`created`,`modified`,`color`) ) ENGINE=InnoDB DE

    MySQLでクロス集計してみた【1/2】
  • ちょっと使えるMySQLの小技5つ+1

    こんにちは。最近ガスを止められ温もりの無い生活を送っている松田です。 今回は最近自分が知ったMySQLの小技をいくつか書いてみます。 んなもん常識だろ!ってネタがあっても優しく見守ってあげてください。 まず今回の実行サンプルには以下のテーブルを使ってます。 mysql> SELECT * FROM user_m; +---------+----------+---------------------+ | user_id | name     | create_datetime     | +---------+----------+---------------------+ |       1 | atsushi  | 2007-05-17 21:53:40 | |       2 | joe      | 2007-05-17 21:53:59 | |       3 | masah

    ちょっと使えるMySQLの小技5つ+1
  • SQL pie chart

    My other half says I’m losing it. But I think that as an enthusiast kernel developer she doesn’t have the right to criticize people. (“I like user space better!” – she exclaims upon reading this). Shown below is a (single query) SQL-generated pie chart. I will walk through the steps towards making this happen, and conclude with what, I hope you’ll agree, are real-world, useful usage samples. +----

    SQL pie chart
  • Rotating SQL graphs horizontally

    We all love graphs. We all love SQL hacks. We all know the SQL hack which displays a character-based graph (example follows for those unfamiliar). But we all love horizontal graphs, not vertical ones. We are used to the X axis being horizontal, Y being vertical. Not vice versa. In this post I’ll present a SQL hack which rotates a vertical graph to horizontal. In fact, the technique shown will rota

    Rotating SQL graphs horizontally
  • 1