Does the 'S' in SQL stand for "standard" or "structured"? - sql

I'm thinking "structured", but my dad claims that when he taught a class that involved SQL (decades ago), they used "standard". I was wondering if this changed over time, or is he mistaken? I googled it with "standard" and did see some pages that said that's what it stands for. Any old timers willing to give a history lesson?

Wikipedia says first:
SQL often referred to as Structured Query Language.
And then further down:
SQL was developed at IBM by Donald D. Chamberlin and Raymond F. Boyce in the early 1970s. This version, initially called SEQUEL (Structured English Query Language).
There's no mention of "standard query language" on the whole page.
The other test of course is to search Google for "structured query language" vs "standard query language". For which I currently get 913,000 results compared to 124,000. So clearly "structured" wins, however interestingly there was apparently a divided preference at one time. This site says:
In the early days of the system there was divided preference between Standard Query Language and Structured Query Language but it did not make a whole lot of difference since most people most of the time called it by the acronym SQL. Now the overwhelming but not complete preference is for Structured Query Language.

It stands for Structured.
The precursor was called SEQUEL, standing for Structured English QUEry Language.
From wikipedia:
The acronym SEQUEL was later changed to SQL because "SEQUEL" was a trademark

In the beginning of Oracle Databases, for instance, it was called 'Standard Query Language'. Yes, it is a structured language...but it is known to us old schoolers has Standard Query Language (SQL).
Now if you want to call it Structure that is entirely up to you. Maybe we should use sSQL or lower case sql has the acronym instead of SQL in upper caps. Either way its entirely up to you. There is always someone trying to put a different twist on things. Whatever acronym you use get the sequel script right.

The original wasn't even SQL acronym, it was SEQUEL: (from wiki)
SQL was developed at IBM by Donald D. Chamberlin and Raymond F. Boyce in the early 1970s. This version, initially called SEQUEL (Structured English Query Language), was designed to manipulate and retrieve data stored in IBM's original quasi-relational database management system, System R, which a group at IBM San Jose Research Laboratory had developed during the 1970s.[8] The acronym SEQUEL was later changed to SQL because "SEQUEL" was a trademark of the UK-based Hawker Siddeley aircraft company

It's certainly "structured" e.g. although logically the SELECT clause is evaluted after the FROM clause you cannot write a SQL statement that way because you would be violating its "structure".

It is Structured Query Language but what i think is one of the reason why they thought it was "Standard Query language" is because SQL is ANSI and ISO which also at the i first place i also thought it was Standard Query Language which gets me wrong in exam.

Related

SQL DIFFERENCE function with names bringing too many results

I have a function that uses the SQL DIFFERENCE function to see if the name of a client is similar to a client already in the database
SELECT ID FROM People p
WHERE DIFFERENCE(p.FullName, #fullName) = 4
Being #fullname a variable passed to the function. The issue I'm having is that if I pass "pedro sanchez" as a parameter, the query will bring me all the Peter's in the database, or if I enter "pablo sanchez", it'll bring record "PEOPLE'S CREDIT UNION".
As I understand the DIFFERENCE function should returns 4 when the two strings are almost identical, but the results I'm having say otherwise.
Is there a way to further specify the resemblance to the DIFFERENCE function, or maybe another approach in finding similar names ?
Difference() is based on soundex(), which in turn -- to be frank -- is a lousy system for comparing strings. Let me add a caveat: it is pretty good for the purpose it was designed for, which is matching last names of people in English. You can read about the rules here and you can try it out here. Using the latter link, you can see that "Pedro" and "People" have the same code, P-140.
Soundex encodes the consonants and basically the first four matching consonants the list it cares about. (Some languages, such as Hawaiian and other Polynesian languages are rather light in consonants. One assumes the designers were not thinking about names in such languages.)
When you are looking for proximity among written strings, Levenshtein distance is a common metric. Unfortunately, SQL Server does not have this functionality built-in, but you can easily find implementations on the web. For most real applications, Levenshtein distance is too slow. Happily, the functionality of the full text search component is usually sufficient for most purposes.

Has SQL changed very much from 2011

I am considering purchasing a SQL book, All-in-One For Dummies, that was written in 2011.
How much has SQL changed since 2011, and are the changes significant enough that it would be pointless to buy this because it is so outdated?
The table of contents divides SQL All-in-One For Dummies into 8 "Books." As a beginner user of MySQL, you will probably only need to focus on Books 1 through 3, and possibly Book 5. The good news is that most of the content in these particular Books is material which likely will not have changed much since the book was published in 2011. So this book should be fine for your particular case.
By the way, you can get the same information for free from the internet. Here are two great online tutorials for using SQL:
http://www.tutorialspoint.com/mysql/ - Specific to MySQL
http://www.w3schools.com/sql/ - General SQL tutorial and reference
If you are learning SQL for querying purposes, here are three things you can look for:
Avoiding the use of commas in the from clause. You can glance through the book and see if it generally uses the join keyword or comma.
The use of common table table expressions. These start with with at the beginning of the query.
The use of window/analytic/tanking functions. These have the over (partition by . . .) syntax. Look in the index to see if row_number() is included -- it would be the most common such function.
All three of these have been part of SQL for over a decade, so they should be in a book written in 2011. That is no guarantee that the book was any good then.

SQL queries to their natural language description

Are there any open source tools that can generate a natural language description of a given SQL query? If not, some general pointers would be appreciated.
I don't know much about NLP, so I am not sure how difficult this is, although I saw from some previous discussion that the vice versa conversion is still an active area of research. It might help to say that the SQL tables I will be handling are not arbitrary in any sense, yet mine, which means that I know exact semantics of each table and its columns.
I can devise two approaches:
SQL was intended to be "legible" to non-technical people. A naïve and simpler way would be to perform a series of replacements right on the SQL query: "SELECT" -> "display"; "X=Y" -> "when the field X equals to value Y"... in this approach, using functions may be problematic.
Use a SQL parser and use a series of templates to realize the parsed structure in a textual form: "(SELECT (SUM(X)) (FROM (Y)))" -> "(display (the summation of (X)) (in the table (Y))"...
ANTLR has a grammar of SQL you can use: https://github.com/antlr/grammars-v4/blob/master/sqlite/SQLite.g4 and there are a couple SQL parsers:
http://www.sqlparser.com/sql-parser-java.php
https://github.com/facebook/presto/tree/master/presto-parser/src/main
http://db.apache.org/derby/
Parsing is a core process for executing a SQL query, check this for more information: https://decipherinfosys.wordpress.com/2007/04/19/parsing-of-sql-statements/
There is a new project (I am part of) called JustQuery.Me which intends to do just that with NLP and google's SyntaxNet. You can go to the https://github.com/justquery-me/justqueryme page for more info. Also, sign up for the mailing list at justqueryme-development#googlegroups.com and we will notify you when we have a proof of concept ready.

Which language was first to introduce the "in" keyword first: SQL or Object Pascal?

(Or possibly another language?)
I know both SQL and Object Pascal first appeared in 1986, but I'm not sure which one had the in keyword first, so anyone who can point me to a definitive source will get my thanks and some reputation.
Yes I searched for the answer, but I think my Google-fu is weak. :(
Pascal itself had in much earlier than 1986 (Pascal was first published in 1970). It was used for set membership testing. My Pascal is rusty, but it went something like this:
type mysettype = set of 1..10;
var myset: mysettype;
if 5 in myset then begin
writeln("found it!");
end;
Further information can be found on the Wikipedia Pascal page.
Also, here is a citation from Wirth's PASCAL User Manual and Report that mentions in as one of the relational operators.
Oracle V2 was released in 1979 as a commercial relational database by Relational Software, Inc (using SQL before its standardisation by ANSI in 1986); followed by IBM's System R. The SQL-86 standard certainly included the IN operator, but can't confirm whether or not it appeared between 1979 and 1986.

What's the best approach to embed RegEx in Oracle or SQL Server 2005 SQL?

This is a 3 part question regarding embedded RegEx into SQL statements.
How do you embed a RegEx expression into an Oracle PL/SQL
select statement that will parse out
the “DELINQUENT” string in the text
string shown below?
What is the performance impact if used within a
mission critical business
transaction?
Since embedding regex
into SQL was introduced in Oracle
10g and SQL Server 2005, is it
considered a recommended practice?
Dear Larry :
Thank you for using ABC's alert service.
ABC has detected a change in the status of one of your products in the state of KS. Please review the
information below to determine if this status change was intended.
ENTITY NAME: Oracle Systems, LLC
PREVIOUS STATUS: --
CURRENT STATUS: DELINQUENT
As a reminder, you may contact your the ABC Team for assistance in correcting any delinquencies or, if needed, reinstating
the service. Alternatively, if the system does not intend to continue to engage this state, please notify ABC
so that we can discontinue our services.
Kind regards,
Service Team 1
ABC
--PLEASE DO NOT REPLY TO THIS EMAIL. IT IS NOT A MONITORED EMAIL ACCOUNT.--
Notice: ABC Corporation cannot independently verify the timeliness, accuracy, or completeness of the public information
maintained by the responsible government agency or other sources of data upon which these alerts are based.
Why would you need regular expressions here?
INSTR and SUBSTR will do the job perfectly.
But if you convinced you need Regex'es you can use:
REGEXP_INSTR
REGEXP_REPLACE
REGEXP_SUBSTR
(only available in Oracle 10g and up)
SELECT emp_id, text
FROM employee_comment
WHERE REGEXP_LIKE(text,'...-....');
If I recall correctly, it is possible to write a UDF in c#/vb for SQL Server.
Here's a link, though possibly not the best: http://www.novicksoftware.com/coding-in-sql/Vol3/cis-v3-N13-dot-net-clr-in-sql-server.htm
Why not just use INSTR (for Oracle) or CHARINDEX (for SQL Server) combined with SUBSTRING? Seems a bit more straightforward (and portable, since it's supported in older versions).
http://www.techonthenet.com/oracle/functions/instr.php and http://www.adp-gmbh.ch/ora/sql/substr.html
http://www.databasejournal.com/features/mssql/article.php/3071531 and http://msdn.microsoft.com/en-us/library/ms187748.aspx
INSTR and CHARINDEX are great alternative approaches but I'd like to explore the benefits of embedding Regex.
In MS SQL you can use LIKE which has some "pattern matching" in it. I would guess Oracle has something similar. Its not Regex, but has some of the matching capabilities. (Note: its not particularly fast).. Fulltext searching could also be an option (again MS SQL) (probably a much faster way in the context of a good sized database)