background preloader

MySqL

Facebook Twitter

You Probably don’t Use SQL INTERSECT or EXCEPT Often Enough. When people talk about SQL JOIN, they often use Venn Diagrams to illustrate inclusion and exclusion of the two joined sets: While these Venn diagrams are certainly useful to understand (and remember) SQL JOIN syntax, they’re not entirely accurate, because SQL JOIN is a special type of a cartesian product, the CROSS JOIN.

You Probably don’t Use SQL INTERSECT or EXCEPT Often Enough

Illustration by Wikipedia user Quartl In a cartesian product between two sets A and B, the result is the multiplication of each set, meaning that each element a ∈ A is combined with each element b ∈ B to form a set of tuples (a, b). Ordinary SQL JOINs do precisely this. When you join BOOK to AUTHOR, you will probably get a combination of every author ∈ AUTHOR with each book ∈ BOOK, such that for each combination (author, book), the author actually wrote the book. The true meaning of Venn diagrams The true meaning of Venn diagrams is much better described by the operations UNIONINTERSECTEXCEPT (or MINUS in Oracle) The result looks like: Now, run the following “equivalent” query:

SQL Indizierung und Tuning. 1m55Wqo.jpg (966×760) Artikel:DBMS und SQL/Einführung in Joins – SELFHTML-Wiki. [Bearbeiten] Normalisierung & Vorstellung des Beispiels Bevor genauer auf Joins und Join-Arten eingegangen wird, soll zunächst das Problem vorgestellt bzw. eine Motivation für die künstliche Herbeiführung des Problems gegeben werden:Frage: Warum liegen nicht alle Datensätze in einer Tabelle?

Artikel:DBMS und SQL/Einführung in Joins – SELFHTML-Wiki

Antwort: Weil eine Normalisierung vorgenommen wurde. Die Normalisierung ist ein Prozess der Umgestaltung von Datenbankstrukturen in der relationalen Welt. Ziel ist die Vermeidung zahlreicher Probleme, die sich aus der einfachen Speicherung „in einer großen Tabelle“ ergeben. Das Ergebnis der Normalisierung sind zahlreiche, kleinere Relationen, in denen weniger bis keine Abhängigkeiten zwischen einzelnen Feldern bestehen und Redundanzen nicht mehr auftreten. [Bearbeiten] Nicht normalisierte Tabelle Nachfolgend soll ein fiktiver Teil einer Unternehmenssoftware betrachtet werden. Kunden kaufen bei dem Unternehmen verschiedene Waren ein. Beispiel: – Tabelle Rechnungen. How To Install MySQL 5.6 On Ubuntu 12.10 (Including memcached Plugin. Version 1.0 Author: Falko Timme <ft [at] falkotimme [dot] com> Follow me on Twitter Last edited 11/16/2012 According to What's New in MySQL 5.6, MySQL 5.6 will bring some performance improvements over MySQL 5.5.

How To Install MySQL 5.6 On Ubuntu 12.10 (Including memcached Plugin

If you want to test out MySQL 5.6, you have to install one of the development releases from the MySQL downloads page because there is no stable release yet. This tutorial explains how to install the MySQL 5.6.8rc1 (Linux Generic) development release on an Ubuntu 12.10 server. This document comes without warranty of any kind! 1 Preliminary Note. HowTo: externen MySQL Zugriff erlauben + sperren mit iptables. Ihr solltet euch natürlich darüber im Klaren sein, dass die Öffnung der MySQL Datenbank auf einem Webserver ein weiteres Angriffsziel bieten kann.

HowTo: externen MySQL Zugriff erlauben + sperren mit iptables

Es ist daher sehr wichtig, starke Passwörter zu verwenden und/oder MySQL nur für bestimmte IP Adressen freizuschalten.

Spatial

MySQL Stored Procedure Tutorial. Each tutorial is packed with the easy-to-understand examples with detailed explanations.

MySQL Stored Procedure Tutorial

If you go through all the tutorials, you can develop the simple to complex stored procedures in MySQL. Introduction to MySQL Stored Procedures This tutorial introduces to you MySQL stored procedures, their advantages and disadvantages. Getting Started with MySQL Stored Procedures In this tutorial, we will show you step by step how to develop the first MySQL stored procedure by using the CREATE PROCEDURE statement. If statement - MySql - only update some rows if the table exists - do not want an error thrown. Set / Change / Reset the MySQL root password on Ubuntu Linux.

3.3.4.4 Sorting Rows. MySQL Federated Tables: The Missing Manual. One of the most exciting features introduced in MySQL 5 is the federated engine.

MySQL Federated Tables: The Missing Manual

The ability to access data from a remote server without the constraints of replication tickles every programmer's fancy. Unfortunately, as of today, the documentation is not quite as detailed as I would like. I have the feeling that the federated engine has been somehow neglected. This article comes from my personal experience with this engine.

Color Codes Actions with this background execute on the data server--the server holding the real data.Actions with this background execute on the federating server--the server with just a link to the real table.This background introduces the fundamental rules of the FEMM (Federated Engine Missing Manual).This background is for comments from MySQL developers about the issues raised here. Basic Federated Usage. MySQL: Using Views as Performance Improvement Tools. The most basic and most oft-repeated task that a DBA has to accomplish is to look at slow logs and filter out queries that are suboptimal, that consume lots of unnecessary resources and that hence slow down the database server.

MySQL: Using Views as Performance Improvement Tools

The most obvious reason for these suboptimal queries is that their authors are generally not that good at writing complex queries. A DBA has a far better chance of writing an optimal query as compared to any other database user, because a DBA has a better understanding of the internals of the database server (query optimizer, etc). The problem Normally looking at logs, one would find a host of suboptimal operations that are performed, for example the use of SELECT * when you only need a few columns.

The most oft-repeated queries that end up in slow logs are ill-formed joins, and these form the largest percentage of problematic queries that a DBA normally fixes.