Slashdot Mirror


An Alternative to SQL?

Golygydd Max writes "Dave Voorhis from the University of Derbyshire has developed a program incorporating Tutorial D, a language designed to overcome of the shortcomings of SQL, and developed some years ago by Hugh Darwen and Chris Date. Until now, no-one had done anything with it but Voorhis is hoping for wider adoption; although we think it would be like pushing water uphill though." Update: 10/13 12:43 GMT by T : An anonymous reader writes "It's being picky I know, but the university in question is in fact called The University Of Derby, not Derbyshire."

36 of 505 comments (clear)

  1. Lotus Domino... by Kenja · · Score: 4, Insightful

    Try using Lotus Domino for a week. You'll be begging to go back to SQL.

    --

    "Have you ever thought about just turning off the TV, sitting down with your kids, and hitting them?"
  2. What's the use? by generalpf · · Score: 4, Insightful

    Is there anything that SQL can't do? I've been using various RDBMS for years and it hasn't come up yet.

    1. Re:What's the use? by treat · · Score: 5, Insightful
      Is there anything that SQL can't do? I've been using various RDBMS for years and it hasn't come up yet.

      Is the sole issue what it can and can't do? what if there was an easier way to express joins? Most queries I write have more joins than actual query. Even though the database already knows the relationships between the tables.

    2. Re:What's the use? by neurojab · · Score: 5, Interesting

      Have you ever seen a 25 way join or a 30 way UNION? I've seen queries that go past a given RDBMS's 32k query size limitation. Even worse, I've seen the code that GENERATES these horrendous queries. It's like seeing your parents having sex; it changes your life forever.

      Please, please, there must be a sane way to query data from a highly normalized database.

    3. Re:What's the use? by jacobcaz · · Score: 4, Informative
      • Call me crazy, but if you have a 25-way join, don't you think you have bigger problems than your querying language? Maybe the person that is asking for the join needs to change their business processes.
      Go work in a big ERP system. We use PeopleSoft and one of our tech has been debugging an AP (maybe GL?) query that's not working as expected and it's a 20 union beast. That's delivered too, not some home-rolled query. I'm sure there are worse queries out there lurking in the hearts of our system too.

      As for just changing our business process, well that's fine in an ideal world, but in practical reality it ain't gonna' happen without an act of Congress. You have to have someone who knows "best-practice" methodolgy come up with a new process, get sign-off across multiple departments and our auditing company so our banks and major vendors are okay with the changes, and then begin process training and roll-out. And that's for a small, private company; if you're public and have to add SOX compliance to the mix...well, good luck.

  3. The shortcomings of SQL by mistersooreams · · Score: 5, Insightful

    I use SQL a lot and I agree that has failings. The clumsiness inherent in, say, nested joins is quite amazing when you consider how important databases are in modern industry. This is a consequence of the "near-English"ness that SQL strives for, but that property is also what causes people to adopt SQL in the first place. We'll probably look back at SQL in five years and laugh... but weren't people saying that five years ago?

  4. dont think so by Anubis350 · · Score: 5, Insightful

    so to overcome the (not really all that many) shortcomings of sql we will all learn how to use something completely new. Yeah, adoption going to be quik and complete........

    --
    "goodbye and hello, as always" ~Prince Corwin, from Zelazny's Amber series
  5. Heh by FiReaNGeL · · Score: 5, Funny

    The name doesn't help... "Tutorial D" doesn't sound advanced at all...

    Try proposing to your boss to replace your mySQL database with "Tutorial D" for... no good reasons? Will happen. Soon. Right?

  6. I gotta say ... by Daniel+Dvorkin · · Score: 5, Insightful

    "SQL is sloppy and unpredictable; Tutorial D is a correct relational database language."

    sounds a lot like

    "C is sloppy and unpredictable; Pascal is a correct programming language."

    --
    The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
  7. I was about to ask the same thing. by Mustang+Matt · · Score: 4, Insightful

    Seems like it can handle just about everything but maybe I'm not thinking outside the box. The biggest limitation is my lack of knowledge about how to do the things I want to do.

    --
    The man who trades freedom for security does not deserve nor will he ever receive either. - Benjamin Franklin
    1. Re:I was about to ask the same thing. by BoomerSooner · · Score: 4, Insightful

      The authors said when you do a query where your float field is null you dont get the instances of null. They say this is a problem but I say bullshit. It's the fault of whatever allowed null to be the value of that field instead of 0.00 or whatever. The data with null didn't magically appear there.

      I agree sql could be better but the more complexity you add the more bullshit code I'll have to figure out what programmers were doing when I'm hired to fix their code. The company I currently work for has stored procedures that are over 4,000,000 lines (total) for report generation. Amazing how difficult it is to debug and work with. Especially since it was done in Transact SQL. I'm probably biased toward PL/SQL because I learned it first but it is so much easier to code in than Transact. (I have about 5-6 years of working in TSQL and about 7-8 in PL/SQL)

    2. Re:I was about to ask the same thing. by EastCoastSurfer · · Score: 5, Insightful

      0.00 != null

      Zero is implying that there is a value there and that it is in fact the number zero. Null would imply that no value ever existed, zero or otherwise.

      In all of my db designs I try to avoid nulls unless absolutely neccessary. A typical situation where nulls are unavoidable would be in an end date field( no end date as of yet). You also usually get nulls back when doing outer joins.

      Remember though that null != 0 != ''. Null is the complete absence of a value.

  8. Ever heard of TSQL? by Sean80 · · Score: 4, Interesting

    Ever heard of TSQL? Neither would have I, if I hadn't been forced to read about it in college. It would seem that there has been a huge number of variants of SQL over the years that have tried to make it "better." The benefits just never seem to outweigh the cost of learning a new language.

  9. Re:Who remembers Knowledgeman? by joebok · · Score: 4, Funny

    Good old K-Man! A fellow programmer once said to me, "K-Man is like a retarded daughter - she can't do much, but you love her anyway."

  10. Re:Me and my buggywhips by Timesprout · · Score: 4, Funny

    You and your newfangled buggy whips. Here in the real country we ride horses the way the good lord intended. When we need to store data we just tell old Uncle Jim and he remembers it. Uncle Jim even invented relational data, why he can tell you just about anything the famiily ever done right back to when great great great great great great grand pappy Bill ran away to marry his 14 year old cousin Mary Lou.

    --
    Do not try to read the dupe, thats impossible. Instead, only try to realize the truth
    What truth?
    There is no dupe
  11. Re:shortcomings to sql? by lub · · Score: 4, Informative

    RTFA:
    -"you ask a database for "all entries where field X is not equal to 47" it won't return any of those where field X is null because instead of saying "Null doesn't equal 47", the value "null" is deemed not to be comparable with any non-null field."
    -"rather arbitrary habit of allowing nested queries in some places but not others, for instance"

  12. Not a replacement language... by ryanmfw · · Score: 5, Insightful

    If you read the article, this isn't about replacing SQL, but more about testing new ideas and languages that could replace SQL. This is better than just saying, "We have a better language. Switch now or be assimilated.", and I'm glad someone's finally taking this approach. Unfortunately, the article only mentions one specific problem with SQL, but I'm sure there are others that these people might eventually solve.

    --
    Hurricane Ivan: A 17th century prison collapsed. All of the inmates escaped.
  13. This could mean... by Performaman · · Score: 4, Funny

    that SQL is SOL.

    --

    I have gas, but my car uses petrol.
  14. Re:shortcomings to sql? by l810c · · Score: 5, Informative
    One thing I always wondered was if there was a way to make a table that had a different number of columns for each row. For instance, if you wanted to insert ids from another table, but the number of ids each row would need is a variable ranging from zero to god knows what... Can SQL do that in a way that doesn't involve making a huge table with tons of columns or one big structure holding the ids separated by colons?

    Yuck, you would never Want to do that. That's what relationships and foreign keys are for. You wouldn't populate your id's across columns, you put them in a new table, one row each, with an foreign key linking them back to main table.

  15. Re:shortcomings to sql? by Fred+IV · · Score: 4, Insightful

    You only need to learn about null comparisons once, and nulls are extremely valuable when you get into eliminating rows from a result sets based on matches from data in other tables.

    Combining a left outer join with a search condition where a primary key is null from the joined table is a quick and dirty way to scrub records where there's a match in the joined table, and would be impossible without the concept of nulls.

  16. Re:SQL is good for some things, but not for others by glwtta · · Score: 5, Interesting
    I think you are confusing "SQL the language" with "MySQL the broken RDBMS implementation", both Postgres and Oracle can easily do what you want with hierarchies; as for user defined functions, support for those is implicit in most database systems (usually in a variety of languages, both SQL dialects and procedural).

    I am not sure what's incosistent about the syntax you mentioned, but maybe that's just me. Though I'd be interested to see in what ways it is "very limited" (especially if those aren't the limitations of a particular databas engine, or relational databases in general).

    --
    sic transit gloria mundi
  17. Re:Don't forget microsoft's X-Query by PhrostyMcByte · · Score: 4, Informative

    XQuery is a standard, not one of Microsoft's creations.

  18. Re:shortcomings to sql? by Deorus · · Score: 4, Interesting

    Usually when you need to write queries for big databases, speed is a concern, so the lower the level, the better. I've never seen a GUI which could write SQL queries as well as I do.

    Additionally, a high level interface is unable to undestand where a query can or cannot be optimized, but I can. For example: there are cases where queries have to be run on a regular schedule to update special optimization tables. These optimization tables are then used when user generated query (e.g.: from web input) comes, so that the user doesn't have to wait for the database to complete that subquery which could have ben run sooner. Only low level can give you such a control.

    Small databases can well use high level interfaces, but those aren't the ones driving the standards anyway since the work is already easy for them. User-friendly interfaces such as Access, Query Builder, and crap like that already provide the required high level for the non-techies.

    If anything comes to replace SQL, I think it won't stand standard long enough as vendors will start adding more and more odd extensions, so the story will probably repeat. Personally I don't care much about the language databases use as long as I feel in control and the general concepts of relational databases remain the same.

  19. It's not about optimization... by Ayanami+Rei · · Score: 5, Informative

    this proposed language is like a superset of sql. It also sort mixes itself with PL/SQL-like constructs as well. I think it's rather novel and it could make your optimization tasks easier if you had access to something like this... less trying to think in terms of the language, more in terms of how you want to acutally manipulate the data.

    This is _not_ a query builder. It's going back, looking at what relational algebra is, seeing what people do with SQL, and then making sure the language has all the idioms required to be "complete" and not arbitrary.

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
    1. Re:It's not about optimization... by pdjohe · · Score: 4, Informative
      Here's a bit of the language enhancements from D-Tutorial. (Note also, that D-Tutorial is the initial building/learning form of future "D" languages.) I'll admit it does simplify things...

      INSERT: A shorthand syntax is available for INSERT. The following:
      INSERT INTO r RELATION {TUPLE {x 1, y 3}};

      May also be specified as:
      INSERT r TUPLE {x 1, y 3};
      Or:
      r += TUPLE {x 1, y 3};
      The lattermost syntax is intended to be vaguely evocative of the "increment by 'n' and assign" operator found in C, C++, Java, and other languages. DELETE: A shorthand syntax is available for DELETE. The following:
      DELETE r;
      May also be specified as:
      r -= ALL;
      The following:
      DELETE r WHERE x = 2;
      May also be specified as:
      r -= WHERE x = 2;
      Or:
      r -= [ x = 2 ];
      The use of "-=" is intended to be vaguely evocative of the "decrement by 'n' and assign" operator found in various popular programming languages. UPDATE: A shorthand syntax is available for UPDATE. The following:
      UPDATE r WHERE x = 2 SET ( y := 3, z := 4);
      May also be specified as:
      r @= WHERE x = 2 SET ( y := 3, z := 4 );
      Or:
      r @= [ x = 2 ] SET ( y := 3, z := 4 );
      Or, because SET is optional:
      r @= [ x = 2 ] ( y := 3, z := 4 );
      Comments: Comments are specified using conventional C++ and Java syntax. Eg:
      // This is a comment line

      /* This is a multi-line
      comment block */
      More info and examples here.
  20. Null is not Zero in SQL by Magickcat · · Score: 4, Insightful

    The article criticises SQL but the author has little familiarity with SQL for example:

    "but the syntax is often inconsistent and unless you use one of the many vendor-specific supersets of SQL it can be tricky to express complex series of operations in a concise manner."

    But in fact, SQL is so popular because complex expressions need little changing from specific vendor offerings. If people choose to program using the subsets, then well and good, but the ANSI standard is generally thought to be sufficient. This is like arguing for the abolishment of HTML and XHTML because Microsoft make a flawed browser - hopefully the database language is better than the reasoning here.

    It then goes on to say "The idea is that there should be no arbitrary restrictions on the syntax of the query language, but at a lower level the database shouldn't run up against idiotic limitations. The limitation in existing implementations that generates the most comment from the various parties in the debate is the problem with "null" values in relational databases. Put simply, a database field has a type (50 characters, for instance, or a floating point number to two decimal places, or an 8-bit integer), but when you don't fill the field in (i.e. it's "null") it loses all its meaning. Even the ANSI standards state that if a field is null it's said not to exist - so if you ask a database for "all entries where field X is not equal to 47" it won't return any of those where field X is null because instead of saying "Null doesn't equal 47", the value "null" is deemed not to be comparable with any non-null field."

    Well, for starters, null is not numeric zero, null is the absence of any data whatsoever, and every SQL doc in the world tells you to not mistake it for zero. Any arithmetic expression containing a null always evaluates to null. For example, null added to 7 is null. All operators (except concatenation) return null when given a null operand. That's exactly why it's the ANSI standard.

    If you want to find "all entries where field X is not equal to 47" then pass your attribute a value like "0".

    SQL is neither clunky nor obsolete. Tutorial D may actually be a better database modelling method, but the article's criticisms aren't sufficient to exault Tutorial D whatsoever. The "Project D" syntax and model may possibly be better, but these criticisms aren't a convincing reason to scrap SQL.

    --

    Si tacuisses philosophus mansisses. If you had kept quiet, you would have remained a philosopher.

  21. I think he's trying to say: by Ayanami+Rei · · Score: 4, Interesting
    I think he's trying to say that joins shouldn't be this hard to describe in the language.
    Compare the symbolic forms:
    Example, theta join
    And the implementation in SQL:
    SQL join example

    Specifically in Tutorial D (and hence Rel) you would do this:
    T1 = JOIN(EMP, DEPT)
    And subsequently do shit with T1. That's it.
    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
  22. Re:shortcomings to sql? by TheMiller · · Score: 4, Interesting

    It would be perfectly possible in a relationally complete language that includes a relational MINUS operator, without NULLs entering into it at all. And Tutorial D, on which the object of this article is based, does of course include such an operator. Whether NULLs are desirable or not is a matter of ongoing raging debate. I've found them easy to avoid, and queries of all sorts easy to understand without them.

  23. Re:SQL has shortcomings...is this news? by kfg · · Score: 4, Informative

    How is SQL "not good enough"?

    Look, I don't mean to be terse, really, but a Slashdot post is not the appropriate place to give a freshman tutorial on database theory, and the very fact that you ask your question means you need one.

    In that light about all I can say is that SQL corrupts data, gives the logically wrong answers to querys and ties the logical model to the physical platform (think of Java and the JVM for an idea of why this might not be a good thing for a cross platform data manipulation system).

    If this answer does not satisfy the solution is simple, read Chris Date's introductory book. He's already written it. I'm not going to duplicate it here. Until you do so you will probably remain ignorant of what a database even is, which, per above, makes it rather hard to explain what's wrong with a particular implimentation (just as it would be hard for me to explain a problem in orbital mechanics to you if you hadn't at least gone through an introductory physics text).

    Of course, you can always go to Fabian Pascal's website ( which Date is a contributor to), but until you read Date's book you're likely to just think of Fabian as some sort of crank, out of ignorance. Until you take the trouble to learn what you need to know to evaluate his arguments you have no real basis for judging him in error.

    Of course, that doesn't stop most people.

    KFG

  24. Re:Any query language is going to be ugly... by Tablizer · · Score: 4, Interesting

    SQL or any derivative thereof will be inherently complex. This is because SQL is merely an implementation of Relational Algebra. That's the key. Real RDBMS's are inherently mathematical in nature.

    I disagree with the "ugly" premise. I have been working on an SQL replacement language myself (described briefly in another thread). I don't believe that (practical) relational operations are inheritantly complex or confusing. There are two problems with the way SQL and/or relational is often presented that gives the false impression that relational operations are inherantly messy, unnatural, and/or confusing.

    First, the "base" operations that Dr. Codd presented with his relational papers are not necessarily the same operations that a relational language needs to present to the user (programmer). For example, in Boolean algebra, the "purist" (and only) operation is NAND (NOT-AND). Any of the other operations can be built with NAND alone. However, humans generally don't relate to NAND because our language has gotten us too familiar with AND, OR, and NOT. We thus use the human-friendly operations instead of the "purist" operations. The trick is to find relational operations that are friendly to humans, yet are still based on the "base" operations. As long as they are defined via the base (proper) relational operations, they are valid.

    Second, SQL does not make it very easy to break big problems into smaller problems. The approach I envision would allow this. There would be intermediate virtual tables that would feed to later operations. One can concentrate on creating one virtual table at a time.

    x1 = foo(....)
    x2 = glab(....)
    result = join(x1, x2, ....)

    One can refer to chunks via name, whereas SQL forces one to nest stuff to acheive the same thing. (Plus, SQL sometimes requires one to duplicate something if two different "roots" of the parse tree need the same construct. By-reference instead of by-nest would fix the duplication.)

  25. Re:shortcomings to sql? by rycamor · · Score: 4, Informative

    Read "The Askew Wall" and other documents by Hugh Darwen at www.thethirdmanifesto.com for some really good brief descriptions of some of the many logical inconsistencies with SQL.

    Really, 95% of the problems that Chris Date and Hugh Darwen have with SQL revolve around an incomplete relational treatment of data. For example, by definition, a relation cannot have duplicate tuples (rows), but a table in SQL *can*. Also, columns in a table should not have a left-to-right ordering, which they do have in SQL (they should be thought of only as attributes, not positionally). Also, SQL fails to completely implement closure, where the result of *any* relational expression becomes a relation which can be in itself modified by any other relational expression. Also, SQL fails to provide a truly extensible approach to user-defined datatypes or domains.

    Etc... etc... there are many other small kvetches and some big ones with SQL. Read the Darwen docs, and you will see some interesting things.

    Essentially, the problem comes down to an ad-hoc experimental language (SQL), which was only intended as a temporary solution, which was then taken over and re-designed by a committee (ANSI).

  26. No new languages needed. by Doc+Ruby · · Score: 4, Insightful

    By creating a new language, "Tutorial D", developers are excluding the other languages as much as they're including new features in the new language. Why not just add a Java package that includes the new syntax? To get anywhere in software development, even Tutorial D code will have to interoperate with existing systems and programmers with existing skills. Someone will have to code a "Tutorial D" JDBC driver, and ODBC, and all kinds of middleware that eats performance, developer time, and introduces the maintenance pitfalls of complexity. And by adding a package to an existing language, they can skip reimplementing the features of the existing language that they include in this new one, like loops, branches and character output. The effort seems as vain as the endless 19th Century conceits of inventing complete philosophical systems from scratch, to serve the reputations of egomaniacs dominating university debates. Why can't everyone just speak Object, with procedural slang and set-theoretical poetry?

    --

    --
    make install -not war

  27. Re:NULL is problematic. by slamb · · Score: 5, Insightful
    Yes, for this reason, if I were designing an SQL replacement, NULL would not remain as it is. I would probably replace it with two values, UNKNOWN and INAPPLICABLE, corresponding to the two cases you described. In fact, Dr. Codd, the father of relational algebra, suggested having multiple types of NULL. (There might even have been more than two. I don't remember what the others were.)

    I might also introduce keywords POSSIBLY and CERTAINLY that collapse tri-state logic (true, false, maybe) into boolean logic. Thus, POSSIBLY(a = 5) would be true when a is UNKNOWN but CERTAINLY(a = 5) would be false.

    Date advocates a different approach - no NULL at all. Instead, he has some sort of parallel table structure; a row in one table for the value being present and in another for the value being absent. With some more complex way of constraining it so there would be no contradictory information in the tables. I don't like this approach - having no NULLs seems simpler than having two, but not once you add in the weirdness of contraints. And not once you realize many tables have multiple nullable columns. Joining so many tables together would get ridiculous quickly.

    In practice NULL seems to not be a huge problem for me. Occasionally a field can either unknown or inapplicable, and I need to distinguish between the two; I have to do a kludgy thing with another field and a CHECK constraint. But for the most part, it's just an extra half second of thought when writing the logic, which isn't too bad. But it does trip newcomers. It would be worth fixing if you were designing a new relational query language from scratch.

  28. Vendor Lock-in is a myth for me by mcrbids · · Score: 4, Informative

    I use PostgreSQL for all my DB stuff. Comparing it to MySQL is like comparing a mini-pickup to an 18-wheeler. PostgreSQL ANSI support is good, and it's very stable.

    When I write custom apps (pretty much all I do) I write to the full capabilities of PostgreSQL. It's "man enough" to handle the biggest projects I'll likely ever see, and I'm not worried that the vendor will up and leave, since there isn't one.

    In fact, PostgreSQL has had an interesting history in that the primary supporters of it have changed several times. PostgreSQL has weathered them all with grace, and remains today an excellent database package with a good, active community and quality developers.

    So, I don't worry about JDBC, I don't write to cross platform, I could give a whit about Oracle or DB2 or whatever, but I don't. PostgreSQL is free, plenty good enough, and it won't go away.

    Why bother trying to make my application portable?

    PS: The article's example about null is stupid. Null = "I don't know". In that context, how could you include values of " 47" if you don't know what the value should be for a particular record?

    I'm interested in this new DB language, if it actually offers a real benefit - but the article does a lousy job of getting me excited about it...

    --
    I have no problem with your religion until you decide it's reason to deprive others of the truth.
  29. Re:Who remembers Knowledgeman? by stephanruby · · Score: 5, Funny
    "And that same programmer probably stays up at night wondering why he's still a virgin."

    I take it logic puzzles were never your strong point.

  30. If you're sensible, you're never touching raw SQL by Julian+Morrison · · Score: 4, Informative

    Talking SQL nowadays strikes me as being like talking raw assembler. You can do it, the tools are even rather nice nowadays, but any sane developer would use a higher level wrapper.

    Like for instance, Hibernate. It does serialize/reconstitute, handles nested objects and data structures, and it's very nearly as easy as programming with regular heap-allocated objects. In any big app if you didn't use some such, you'd end up reimplementing it.

    I see no reason wrappers like Hibernate have to backend onto SQL and only SQL. They could as easily emit and control this "Tutorial D" language.