views:

763

answers:

16
+4  Q: 

Is SQL outdated?

A friend of mine who is a computer scientist told me he thinks SQL is a thing of the past. I used SQL for years and think the language is totally relevant when dealing with database specific tasks.

My friend believes the new frameworks (e.g.: django, etc) that are coming out are making things even more generic, making SQL an outdated database language. I am wondering what others think about this.

+37  A: 

SQL could be better, but it does what it does better than anything else.

Lance Roberts
Short, simple, and to-the-point. +1
musicfreak
Very well put.
Ben Blank
Nice answer - it sums up "necessary and sufficient" quite nicely.
David Robbins
Could be added that "what it does" is interacting with relational sets.
voyager
+2  A: 

SQL has been fine tuned to provide a lot of control for people wanting to perform very specific queries on a database. Even if the databases shift (from RDBMS' to distributed key-value pair dictionaries, for example), there's no reason to think a knowledge of SQL won't be invaluable. I think that SQL, as far as a database language, is what the distributed systems guys will reach for (as a simple key-value pair is inherently limited).

Alex Gartrell
+2  A: 

If you are just building crud applications, then it might appear like it is outdated, for more sophisticated queries it would be a pain to do using an ORM, or the code will end up longer than the original sql query.

Tomh
+2  A: 

SQL is a query language for relational databases, it is quite mature and has the functionality that you will need to query relational data.

The frameworks your friend are thinking of are ORM solutions, that try to hide the relational part of the database and mimic it as an object-oriented database, so you can use OO-like fetures to access your data.

This might mean that the future is object-oriented databases, but no one has prooved this claim yet, mostly because relational databases are quite well performing, and ORM tools can hide the relational part of their design.

And of course there are other databases which are emerging, like hiearchical XML databases, with XQuery as the query languge. XQuery 1.1 is quite good in terms of expressiveness, and there are some tools that will let you use XQuery to query relational databases but this won't mean that SQL is outdated.

SztupY
+10  A: 

There are many people who would like to think that it is outdated. There are many reasons for this but basically it comes down to the relational-object mismatch. A lot of effort has gone into creating ORMs ("object relational mapping") that abstract away the database. In short, SQL is being treated as a problem that needs to be fixed.

Unfortunately abstractions are leaky.

Databases and SQL will be around for some time to come.

cletus
SQL itself has very little to do with the object-relational mismatch. That's the fault of relational databases themselves, not of SQL.
musicfreak
Blame goes both ways - objects and relational databases are both at fault. One's instance-based, the other's set-based.
duffymo
I thought ORM was object relational mapper - I'm wrong again!
alex
Woops, fixed .
cletus
+1 , good fix :)
alex
+10  A: 

Jeff Attwood stated on Hanselminutes that he thought that "SQL is like assembly language for the database" and I tend to agree. I also agree that SQL could be better but it gets the job done quite well. And if you work in the Microsoft world then you can do C# in the database directly, bypass sql all together in favor of LINQ to SQL or NHibernate, etc. then you have a lot of options that allow you to move around writing direct sql. But at the end of the day...when I need a really optimized query...you can't beat the underlying SQL! ...sort of the same reason that assembly is still floating around these days!

Andrew Siemer
What about XML Database together with the XQuery? I once read a passage which compare both of them with similar set of data (with very large talbes, and also tables with nested relationship). The result of XML database is very competitive with Relational SQL engines, and not to surprise that nested tables (which is the basic structure of XML), XML database outruns SQL.
xandy
I am not saying that SQL is crap...on the contrary it very much has it's place. As does object databases and an XML database. This is why SQL Server now supports both happily.
Andrew Siemer
+10  A: 

SQL isn't going anywhere.

There might be other alternatives (e.g., object databases, Big Table, graph databases), and people who don't like SQL (e.g., Anti-SQL), but rest assumed that relational databases will be around for a long time. Your bank will be using relational databases after we're all dead and gone.

duffymo
Perhaps "SQL isn't going away" might be clearer...
gbn
confidence in the banking system's longevity; nice :)
u07ch
Maybe that confidence is misplaced when we're talking about American banks....good point.
duffymo
+4  A: 

Frameworks like Django abstract away the SQL from you, because it can be tedious. They still use SQL and couldn't function without it. It does what it needs to. Does it have flaws, sure, but what language doesn't. , personally, don't like how NULL is neither true nor false.

Now, I almost agree that learning SQL is outdated. There are many ORMs out that take away the need to know it. However, I don't think that a good software engineer can really go without it. I have worked with a number of people who don't know how to make a query, and just sit there dumbfounded. Then when they figure it out, they make queries that are inherently vulnerable to injection.

geowa4
"...I almost agree that learning SQL is outdated..." - good thing you said 'almost'. I think it's a requirement, even if you use an ORM. You might not always like the dynamic SQL you're given.
duffymo
actually, I have gotten to like NULL quite a lot with its Zen-like property - but it does bite me in the rear every now and then :(
Daren Thomas
+4  A: 

Like a lot of programming, you have to use the best tool for the job. A lot of people think C is outdated but you wouldn't write a real-time operating system in Java.

+2  A: 

I think that it's possibly true that relational databases and SQL aren't the perfect fit for web applications. After all, both RDBMs and SQL is considerably older than the web, and were mostly designed for applications with quite different needs than our current. So in that sense I think its true that it is outdated to some extent, and we'll probably see a decline in database use for internet applications.

Lets not forget though that the kind of business applications for which SQL was originally designed is still alive and well, so it's a safe guess that relational databases will be around for a long time.

Emil H
+12  A: 

The fact that your friend did not explain / realize / understand that Django uses SQL for its underpinnings pretty much invalidates the argument he attempts to make.

ORM are a fairly costly abstraction layer when you are looking to deal with high performance applications / sites. If you are doing complicated database queries (multi table unions / intersections etc) and using an ORM it is likely you well send the "raw sql" directly through the ORM to the database.

wlashell
+2  A: 

I don't think that SQL as a concept is out of date - a data access language that describes what is to be done rather than how its to be done is still relevant. The fact that most business systems in production, entering production or on the drawing board that require data storage are still built around SQL says that its still relevant.

What has not kept pace is the adoption of newer elements of the standard and the pace of innovation in the standard lags seriously from demands of modern applications.

MikeJ
+6  A: 

Read this: "Why use Stored Procedures?". Ignore the title though: read the content.

Your friend answered his own question: SQL has outlasted all the new frameworks because "data has a long lifespan": frameworks don't.

gbn
+5  A: 

SQL as a language has evolved over time (SQL-87, SQL-89, SQL-92, SQL:1999, SQL:2003, SQL:2006, SQL:2008) to satisfy ever-growing demand for database technologies in general and relational database technology in particular.

Comparing of SQL to database assembler language is absolutely correct analogy - but it's assembler in reverse: all its higher-level derivatives are in fact lower level languages representing mix of ORM frameworks and less successful alternatives or simplified derivatives.

The only database language that can claim to be higher level than SQL is post-relational database PICK-BASIC et al. But they were never successful in overtaking SQL's place in database world, in part, because of a solid place relational database technology occupies as data platform of choice in majority of software systems of all ranks and levels. And this solid place relational databases almost 100% own to declarative power and expressiveness of SQL.

So there is a self-sustained system comprised of two elements - database technology (relational) and its language (SQL) - and both components propel each other to ever-growing dominance.

Next question should be what would it take to overcome dominance of relational databases and SQL? There were hierarchical databases, object-oriented database, xml databases. After each attempt SQL simply contained new attempts as additional feature set and dismissed technologies as a whole. My guess that until computer power gets to completely new level of performance the alternative to SQL (relational databases) is hardly possible. The new cloud computing technologies are first signs of such alternatives though.

grigory
A: 

Not only is SQL outdated, it is an anachronism. RoR's ActiveRecord and other Object mappings like Django's are easier to use and more portable than SQL.

MikeN
Activerecord and ORMs offer an abstraction which rely fundamentally on SQL; they aren't an alternative.
Bayard Randel
The C programming language offered an alternative to assembly even though at its roots it is implemented in assembly. The point is you don't need assembly code. You can also implement ORM's using non relational non-SQL databases.
MikeN
the problem i have with that analogy is that sql is still changing. assembly isn't really going anywhere; there are no new features that i just gotta have. granted, there are developing technologies that abstract away the sql, but in many (not-so-)legacy systems, sql knowledge is vital. assembly knowledge is not, unless you specialize in that sort of stuff. or are crazy.
geowa4
Interesting... Almost the only answer that agrees with your "friend" and it was accepted. Didn't expect so many counter arguments?
gbn
it's comparing apples and oranges.
grigory
I dissagree, ORM's make day to day things easier, but even then all ORMs in the end create SQL. And in many cases you will have to side step the ORM to do something in the database. There are also times like reporting or loading data to a warehouse where your not going use the objects.
JoshBerke
This is painfully wrong. ORMs are far too immature to cover any serious database work. If you think ActiveRecord or Django can replace SQL, you've only been building toys. Toys are definitely OK - probably 90% of websites count as such, and many LoB apps as well. But using those as empirical evidence is just silly. Your findings making your Django site do not apply to Amazon.
Rex M
Last week I replaced a routine that was taking over 1000 queries using an ORM tool, with one view, replete with lots of outer joins, and one SQL query, which the overly abstract ORM was not allowing me to acheive. Earlier this year I worked at a RoR shop where the ostensible lead engineer admitted he didn't specify indexes anymore since ActiveRecord was so easy. ORM's are like sugary candy that rot your teeth especially in the hands of developers who mistakenly think the most important thing is ease of development.
George Jempty
+3  A: 

By SQL I'm going to assume your friend is talking about relational databases in general, which certainly aren't going anywhere - businesses require them for datawarehousing, and reporting across huge disparate systems. There is a definite trend however toward distributed applications where Key/Pair Databases such as BigTable and CouchDB make a lot of sense. I suspect these newer technologies will become more commonplace on the web, but SQL and relational databases will continue to be used in the Enterprise.

Bayard Randel