views:

3671

answers:

11

Can somebody highlight the main differences between PL-SQL and SQL? And which one do you recommend for a newbie who wants to dive into DBA?

A: 

PL-SQL is SQL and the language that goes with it for Oracle. Start with SQL.

carson
A: 

pl-sql is just oracle's flavor of the language, like t-sql is for SQL Server. Every database has it's own particular dialect.

Joel Coehoorn
+11  A: 

SQL is a query language that allows you to issue a single query or execute a single insert/update/delete. PL-SQL is Oracle's "Programming Langugage" SQL, which allows you to write a full program (loops, variables, etc.) to accomplish multiple selects/inserts/updates/deletes. You should learn SQL first, then move on to PL-SQL. You will probably need both to be an Oracle DBA.

Shane
+1  A: 

I advise picking up ANSI/ISO SQL first. You need to know SQL before PL/SQL will be useful to you, as a lot of PL/SQL involves writing triggers, procedures, and functions that in turn call SQL as appropriate.

P.S. You only need to know PL/SQL if you're going to be an Oracle DBA. ANSI/ISO SQL, however, is fairly universal. ANSI/ISO SQL is not, however, feature complete, so expect to have to pick up some additional SQL specific to the server type you use.

R. Bemrose
"You only need to know PL/SQL if you're going to be an Oracle DBA" ... well, I'll have to disagree with that.
David Aldridge
+2  A: 

SQL is used to perform operations on data. There is an ANSI standard for it. Most databases support it, although each may have differences in the interpretation, and each typically has some proprietary extensions to it.

PL SQL is exactly as Shane described. It allows programmatic manipulation of SQL and result sets, and if you look at the Oracle PL-SQL APIs, lots of other stuff too.

I agree again with Shane: I do not know anyone that could realistically call themselves an Oracle DBA without knowing both SQL and PL-SQL.

Bernard Dy
+1  A: 

I agree with Shane.

I'll add that PLSQL is essentially a procedural programming language similar to Pascal with SQL extensions.

Many language elements are common between SQL and PLSQL. SQL is definitely a prerequisite to learning PLSQL as it is almost (but not quite) a subset of the the PLSQL language.

Learning SQL provides more bang for the buck since experience with ANSI SQL can be applied to many database vendors while PLSQL is specific to Oracle.

darreljnz
Actually it's siilar to Ada with SQL extensions, on account of being based on Ada. It even uses DIANA (Descriptive Intermediate Attributed Notation for Ada) also. http://en.wikipedia.org/wiki/Diana_(intermediate_language)
David Aldridge
A: 

SQL is the only language through which you create or modify data and structures in Oracle. Although other tools will connect with the database, they all use SQL to read and modify data.

Oracle's PL/SQL is a programming lanuguage that extends SQL to include procedural elements, such as loops and whatnot.

With PL/SQL alone there is little you can do -- learn SQL first, then learn PL/SQL to learn how to write effective scripts and programs.

David Aldridge
A: 

SQL is a query based language whereas pl sql is a programmong based language. unlike SQL,pl sql have the exception handling facility.

A: 

sql is a structured query language whereas pl-sql is a combination of procedural language & sql. sql is a data oriented language for selecting & manipulating sets of data and pl/sql is a procedural language to create application.

A: 

pl/sql has a fast execution speed as compared to sql because it passes a block of statements to be executed to the server whereas in sql one statement is transfered to the server at a time.......

A: 

I believe that the other answers do a good enough job at explaining the difference between the PL SQL and SQL. What I want to let you know is that we write SQL and wrap it with PL SQL that has been created utilizing business function naming conventions that represents the business transaction. You should always try to do data manipulation through SQL not PL SQL. There are times where you do need to loop through the data row by row (slow by slow) but try to avoid it with CASE statements and Oracle analytic in your SQL. The notation that a DBA knows PL SQL is very false. I don't know of any DBA that can write PL SQL. Many of them wrote PL SQL at one time but that was long ago. DBAs spend their time administrating the database and they leave the SQL and PL SQL to the developers. :)

Tom Clark AaiCanHelp.com