What is SQL, PL/SQL, T-SQL and difference between them
Today I got an email from a student who is pursuing his Bachelors degree in Computer Application (BCA). He visited my blog and sent me an email regarding his confusion with terms like SQL, T-SQL, PL/SQL, and asked me what is differences between them and how are they related? I had a chat with him and told the basic differences, but he further asked me how they are related to Microsoft SQL Server, Oracle, MySQL, etc? As he is studying SQL only based upon Oracle in his course curriculum, these all terms were not clear to him, so I cleared all his doubts while chatting with him.
After a while I had a same reminiscence that when I was a student I also had these doubts and confusions, and there was nobody to guide me, but I gradually came to know about this and it took some time. Thus, I’am taking this opportunity to put all these things together here in a single blog post for my readers (specially students) and for my reference as well.
–> SQL: stands for Structured Query Language and is pronounced as Sequel, and in early days it was also known as SEQUEL only.
– IBM in early 1970s developed SEQUEL which stands for Structured English QUEry Langauge for their RDBMS. The acronym was later changed to SQL, as SEQUEL was already trademarked by some UK based aircraft company.
–> PL/SQL: stands for Procedural Language/Structured Query Language and is used with Oracle database to create PL/SQL units such as Procedures, Functions, Packages, Types, Triggers, etc. which are stored in the database for reuse by applications that use any of the Oracle Database programmatic interfaces.
– Oracle in 1970s known as “Relational Software” saw SQL potential and influenced by Boyce, Codd and Chamberlin developed their own RDBMS product which was commercially available as Oracle Database. Oracle is supported on many Operating Systems like Windows, Linux, Solaris, AIX, OpenVMS, etc. [Oracle Database]
–> DB2: IBM during early 1980s made SQL commercially available with its product known as IBM DB2 from its prototype “System R”. [IBM DB2]
–> SQL Standardization: Later in 1986 SQL was adopted as a Standard by ANSI (American National Standards Institute) as SQL-86, and today the latest Standard is known as SQL:2011
✔ As a standarg SQL should support following:
– Language elements: Clauses, Expressions, Predicates, Queries, Statements.
– Operators: =, , >, =, <=, BETWEEN, LIKE, IN, NOT IN, IS, IS NOT, AS, etc.
– Conditional expressions: CASE, IF ELSE
– Queries: which include SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, etc.
– Data Types: Numeric, Char, Bit, Date and Time
– NULL or 3VL (Three value Logic)
– DDL, DML, TCL
–> T-SQL: stands for Transact-SQL, and is Sybase & Microsoft’s proprietary extension. T-SQL is very similar to PL/SQL, one can create T-SQL units such as Procedures, Functions, Types, Triggers, etc. as mentioned above.
– In 1987 Sybase shipped their first RDBMS product known as Sybase SQL Server. [Sybase]
– In 1988-89 Microsoft had an agreement with Sybase and ported the Sybase RDBMS to OS/2 platform and marketed it as Microsoft SQL Server 1.0, which was equivalent to Sybase SQL Server 3.0. [Microsoft SQL Server]
– In 1993 Sybase and Microsoft dissolved their partnership, and Microsoft bought the SQL Server code base from Sybase and both went different streams to develop their own product.
– Till SQL Server 2000 Microsoft has Sybase code base, and this was completely written in SQL Server 2005.
– Microsoft SQL Server is only supported on Windows Operating Systems.
–> MySQL: was founded by a Swedish Company MySQL AB in 1995 and is the most widely used open-source RDBMS. The MySQL development project has made its source code available under the terms of the GNU General Public License. MySQL does not currently comply with the full SQL standard. In 2008 Oracle corporation completely acquired MySQL. MySQL is supported on many Operating Systems like Windows, Linux, Solaris, OS X and FreeBSD. [MySQL.com]
–> FoxPRO and dBase: were very popular DataBase Management System (DBMS) products in mid 1980s and 1990s. They lack some RDBMS features and are out of support now, but are still being used in various legacy systems.
– FoxPRO is supported by Microsoft and was a text-based Procedural programming language and DBMS, for MD DOS, Windows, and UNIX. Microsoft Visual FoxPRO 9.0 being the latest and probably the last version published in 2007. [FoxPRO msdn]
– dBase was a very popular DBMS package including core Database engine, a Query system, a Forms engine and a xBase programming language with *.dbf file format. [dBase.com]
–> Here is a complete timeline that shows SQL and how it got evolved as different Products by different Vendors/Companies (click on the image to expand):
–> There are many other popular SQL Products/System softwares available in market, and major of them are:
1. Oracle database
2. Microsoft SQL Server
3. IBM DB2
4. MySQL
5. PostgreSQL
6. Teradata
Create a software development environment with a tool such as Visual Studio and access it from any where on any device on your hosted virtual desktop from CloudDesktopOnline.com. Also, if you prefer a server, try Apps4Rent.
Reblogged this on Christopher J. McClellan and commented:
A brief history of SQL.
Thanks for re-blogging.
Can you please also rate the post at the top?
Regards,
Manoj
i am good at java programming,
i want to learn sql.
is it proper?
Nice Explain sir,
Thanks,
Hey,
I learnt so much in such little time about #topic. Even a toddler could become smart reading of your amazing articles.
I have requirement like
select COL1,Col2 from A
minus
Select COL1,COL2 from B;
both tables have 50+ millions record so I want to automate a job which will execute this query for 1millions records for one time and then again 1 millions for second time…like loop and store output in record type.
But nice Article Mate! Great Information! Keep up the good work!
Kind Regards,
morgan
Giving a big picture is always helpfull!
The blog is Very helpfull… as it explains how it started and how transformed to the present form… 🙂
Hi thank you for this explanation.
I have a question to ask you.
I am new to the topic and I was thinking about buying a book that he knew explain SQL and MySQL databases.
If you was teaching, for example at the University, which book would you recommend to start whit it’s?
That’s very clear. I have a question though. For plsql that’s written to run against an Oracle database, will the same script work on Microsoft SQL Server?
Thanku sir..for the nice explanation.Actually iam going to attend an interview in oracle.could you mind suggesting me a few topics that i should know before attending it?
Hi There,
This is indeed great! But I think perhaps you are generally referring What is SQL, PL/SQL, T-SQL and difference between them which is getting unsustainable.
I need to check various columns of a particular table to see if they are not really being populated or the data is always the same. So that we can perhaps remove some columns going forward. This table will be filtered by std_job_no column as I have a list of values for this column which pertain to a particular area of the data.
To retrieve the column names for the table I have written this which produces the correct results. note I do not require std_job_no column as I will be using this later as part of the group by query.
SELECT DISTINCT TABLE_NAME, COLUMN_NAME FROM ALL_TAB_COLUMNS
WHERE OWNER =’ELLIPSE’
AND TABLE_NAME=’MSF690′
AND COLUMN_NAME<>’STD_JOB_NO’
ORDER BY TABLE_NAME
Now I want to loop through these column names and substitute column_name into the following query
select
COL,UMN_NAME, COUNT(STD_JOB_NO)
from msf690
where std_job_no in (
‘009045’, ‘009053’, ‘009188’, ‘009189’, ‘009190’, ‘009236’, ‘009275’, ‘009310’, ‘009319’, ‘009320’, ‘009321’, ‘009322’, ‘009323’, ‘009324’, ‘009325’, ‘009326’, ‘009327’, ‘009328’, ‘009419’, ‘009459’, ‘009460’, ‘009461’, ‘009462’, ‘009463’, ‘009464’, ‘009582’, ‘009590’, ‘009591’, ‘009594’, ‘009616’, ‘009617’, ‘009618’, ‘009619’, ‘009620’, ‘009621’, ‘009622’, ‘009623’, ‘009624’
)
and dstrct_code=’RTK1′
GROUP BY COLUMN_NAME
So i would then get the list of all values for each column name and how often they are populated.
It should be something along the lines of..
DECLARE
BEGIN
FOR RRR IN (
SELECT DISTINCT TABLE_NAME, COLUMN_NAME FROM ALL_TAB_COLUMNS
WHERE OWNER =’ELLIPSE’
AND TABLE_NAME=’MSF690′
AND COLUMN_NAME<>’STD_JOB_NO’
ORDER BY TABLE_NAME
)
LOOP
EXECUTE IMMEDIATE ‘select ‘ ||
RRR.COLUMN_NAME || ‘, COUNT(STD_JOB_NO)
from msf690
where std_job_no in (
‘009045’, ‘009053’, ‘009188’, ‘009189’, ‘009190’, ‘009236’, ‘009275’, ‘009310’, ‘009319’, ‘009320’, ‘009321’, ‘009322’, ‘009323’, ‘009324’, ‘009325’, ‘009326’, ‘009327’, ‘009328’, ‘009419’, ‘009459’, ‘009460’, ‘009461’, ‘009462’, ‘009463’, ‘009464’, ‘009582’, ‘009590’, ‘009591’, ‘009594’, ‘009616’, ‘009617’, ‘009618’, ‘009619’, ‘009620’, ‘009621’, ‘009622’, ‘009623’, ‘009624’
)
and dstrct_code=’RTK1′
GROUP BY RRR.COLUMN_NAME’
And then I want to dbms_output this without inserting the values into a table as I don’t have permissions to create tables.
Great effort, I wish I saw it earlier. Would have saved my day 🙂
Merci,
Peter