• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Head First SQL - Standard SQL

 
Galen Benson
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a fairly new SQL user since I spent most of my time working on embedded systems up to now. I have, in the last 6 months, worked on both SQL server and Oracle DB's. I am finding that the "flavors" of SQL can be quite different, especially when it comes to performance. Does the book address the performance information associated with things like sub-queries, full table scans etc.

Does anyone have an opinion on ANSI Standard SQL?

Is it just always better to use ANSI Standard SQL?

If I create ANSI Standard SQL can I really port it from SQL-Server to Oracle and even DB2 with out changes?

The other day I was in an interview and someone asked me "What is JDBC?"
Other than the obvious "Java Database Connectivity" and that it's a standard API... I didn't know what else to say. Is there more?

Sorry for all the questions... but I'm a newbie.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Does anyone have an opinion on ANSI Standard SQL?

Is it just always better to use ANSI Standard SQL?

It depends where you use it. If you mean writing SQL Queries in a JDBC application then yes, I'd always stick to ANSI SQL, otherwise the application looses its portablility. In reality, I'd most likely go for an ORM, rather than use SQL directly then I don't even have to think about this.


If I create ANSI Standard SQL can I really port it from SQL-Server to Oracle and even DB2 with out changes?

According to the documentation, yes.
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Galen Benson:
The other day I was in an interview and someone asked me "What is JDBC?"


You know, when you asked this, I had to check your name because I often do interviews and this is a question I routinely ask. ;)

Sure, JDBC allows you to connect to a database. However, the real beauty of JDBC is the way in which it does that. Essentially, JDBC provides an added layer of abstraction between your application and your database. If you ever decide to swap out your database (Oracle for SQL Server, for example), you shouldn't have to change your Java code, at all, except perhaps to load a different driver. That's the real benefit of using JDBC - it doesn't tie you to a specific database vendor.

If you think about it, it's really rather close to the whole notion of Java - a language that allows applications to be moved easily from one OS to another. JDBC allows you to swap out databases in a similar manner.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic