Maggie Nelson

Tag: oracle

Oracle Buys Sun

by maggie on Apr.20, 2009, under entry

Oracle buys Sun. Sun owns MySQL. Oracle’s press release about it here.

Does this mean an end to MySQL? Are all companies using MySQL will now get really harsh sales pitches to use Oracle? I love Oracle and I love MySQL – the beauty of both is competition. “MySQL is better than Oracle because…” and “Oracle is better than MySQL because…” are what drives both to get better.

Good for Oracle and Sun, but I’m curious to see what happens.

On the upside, Chris and Lig will now be coworkers.

3 Comments :, , more...

The Rules of (Software) Engagement

by maggie on Mar.08, 2009, under entry

Being an Oracle fan, I often find myself on the defense trying to explain its awesomeness While it’s uber expensive, obviously it has desirable features that sometimes make it worth it. On the other hand, in my experience, Oracle takes a much stricter, “comp-sci” (quotes on purpose) approach while MySQL can be wonderful in forgiving developers and expecting that developers are more concerned with getting stuff done rather than being nitpicky (which is true most of the time, really).

Allow me to elaborate. There are a few features that are available to MySQL developers that are a bit harder to find if you’re using Oracle. Here are a couple:

This one’s kind of a cliche and if I had $1 for every time I heard it, I’d have maybe $20 by now!

“Oracle doesn’t have SHOW CREATE TABLE!”

So let’s level the playing field a little bit. First off, MySQL doesn’t offer “show create table” either. When you see:

mysql>

you’re actually running a MySQL client that provides this functionality. With Oracle, the somewhat default client is sqlplus – it offers access, but it’s not very fancy. You can use gqlplus (built by the open source community!) for things like command line history (aka “arrow up to previous query”), or go full GUI experience with SQL Developer (which I personally recommend, it’s pretty sweet). The latter offers functionality that will do the same thing you expect “show create table” to do when using MySQL client.

More importantly, Oracle offers an entire set of built-in tables that provide data about your database schema. Next time you have access to Oracle, try this:

DESCRIBE user_tables;
DESCRIBE user_tab_columns;
DESCRIBE user_constraints;
DESCRIBE all_source;

Oracle offers you hundreds of ways to find out information about your schema. My hunch is that the reason “show create table” does not come in a default client is because of the amount of possibilities this means. Compare the CREATE TABLE statement available in Oracle and in MySQL. There is simply so much that “show create table” could show you in Oracle, making choices what to omit and deciding what is default perhaps is better left to developers than to a shell script. (It is also my belief that your DDL – how your tables are created – should be stored as code under version control, so there’s that.)

Another “Zomg, MySQL is so much better than Oracle!” claim I witnessed recently is:

“Oracle doesn’t have INSERT IGNORE!”

The response is, yes, of course it does, it’s just not called “insert ignore”. “Insert ignore” is MySQL’s feature that veers away from standard SQL as much as anything else.

So what’s the deal here? I find that the best way to find equivalent features between MySQL and Oracle is to take a step back and think in more general, basic language concepts. What “insert ignore” really does is:

  1. attempt to insert
  2. if failed due to a constraint violation, continue

This looks to me to be simple exception handling! Oracle comes with PL/SQL, an entire language of its own. Surely it has a way to handle exceptions! Here are a couple of ways to do “insert ignore” in oracle:

begin
    insert into some_table(field) values ('zomg');
exception
    when DUP_VAL_ON_INDEX then
        return;
end;
/

Not only does Oracle allow you to do “insert ignore”, it provides you with fine grained control about exceptions – in this case, I am catching the case when a unique key (such as the primary key) is violated. In his blog post, Hampus recommends a similar approach and also points out that you can use Oracle’s MERGE statement (which, incidentally, is on of my favorite statements!) for this purpose.

I guess the purpose of this post is to once again point out the inconsistency in how different databases implement standard SQL (I talked about this a little bit in a post about The Meaning of Keys). When you see something that Oracle has and MySQL and vice versa is sometimes tied to this different approach. I’m willing to concede that MySQL has some awesomeness, such as the kick-ass GROUP_CONCAT function. But if you still feel like QQ’ing at Oracle (e.g. in comments on this blog post), fair warning, I will continue to defend it – I only ask that you QQ constructively!

8 Comments :, , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Tags

RSS Planet PHP

  • Getting started with the Midgard content repository
    I'm doing a talk today in the Bossa Conference about using Midgard as a content repository for mobile applications. As part of my presentation I wrote some simple example code for using the Midgard APIs in Python, and thought they would be good to share to those not attending the event as well. The idea of a content repository is that instead of coming […]
    Henri Bergius
  • Neural Networks in PHP
    Neural Networks in PHP By Louis Stowasser Neural networks allow emulating the behavior of a brain in software applications. Neural Networks have always had a too steep learning curve to venture towards, especially in a Web environment. Neural Mesh is an open source, pure PHP code based Neural Network manager and framework that makes it easier to work with […]
    PHP Classes
  • CMS Watch on their Midgard usage
    Which CMS does The Real Story Group Use? (Tony Byrne / CMS Watch): The answer is, we use an open-source platform called "Midgard." We picked it nearly ten years ago, and it has held up fairly well.... One of the things we like about Midgard actually makes it rather unsuitable for many simpler publishing scenarios: it is highly object-oriented. This […]
    Henri Bergius
  • Upgrades In Open Source
    PHP 5.3 has been out now for eight months, and in that time lots of projects have made decisions to begin developing against this version of PHP. Juozas Kaziukenas makes the argument that you shouldn’t be afraid of PHP 5.3 and he provides a number of excellent points to support his argument. I don’t dispute [...] […]
    Brandon Savage
  • Seed doc updates, and Gio async directory listing
    The documentation for seed gobject introspection is improving continually, I now have a jhbuild virtual machine, which is picking up the latest versions from git.In addition many of the documentation details have been expanded, includingInterfaces, Enumscallback methods are now documentedMore libraries have been added.More doc comments can be picked upWith b […]
    Alan Knowles