What is "sql"
SQL is an acronym that means "Structured Query Language" (although non-standard). A subset of the SQL standard consists of the data definition language (DDL - Data Definition language) which is used to create tables and constraints (for example, CREATE
, DROP
, ALTER
). Another subset is the data manipulation language (DML - Data Modelling language) that is used to access and manipulate the data contained in the tables, but without changing the structure of these tables (for example, SELECT
, INSERT
, UPDATE
, DELETE
). And finally the subset of commands for access control (for example, GRANT
and REVOKE
).
Interaction with relational databases requires the use of SQL, and over the years vendors have implemented SQL dialects to provide more functionality and also to simplify it. Due to these deviations from the standard, SQL is impaired - a syntax that works on one vendor does not necessarily work on another. ISO/IEC standards (formerly ANSI) have been beneficial in resolving such situations, but adoption is selective. ISO/IEC means that an query, query in Portuguese, should be portable to other databases, but this does not mean that the performance will be the same, nor that the performance will be identical to the native functionality.
Most of the DBMS (Database Management Systems) offers additional extensions to SQL for writing stored procedures (stored procedures). In Oracle is PL/SQL, in Postgresql is PL/pgsql. Thus, the tags plsql and plpgsql should only be used for problems directly related to writing stored procedures. Microsoft SQL Server uses the term T-SQL (tsql) for both, basic SQL (queries, DML, etc.) and for the language used in stored procedures.
Recommendation for tag use
This tag should be used for SQL programming language issues in general, as well as tags for specific products (for example, questions about Microsoft SQL Server should use the tag sql-server) implement some dialect of the language. SQL is the umbrella under which these products exist; mark them by product (including the version, for example, oracle11g, sql-server-2008) is the easiest way to know which functionality is available for the task at hand. Please read this summary on the SQL standard (1992 in this case, widely implemented) and, if you can, do not hesitate to consult the book itself.
Free SQL Programming Books
- Developing Time-Oriented Database Applications in SQL
- Use The Index, Luke!: A Guide To SQL Database Performance
- Learn SQL The Hard Way
- SQL Tutorial For Starters
- SQL - Free Books
Useful resources
You should always give full code examples in your question or answer, but you can also isolate problematic code and reproduce it in an online environment such as SQL Fiddle.
If you have questions about which SQL resource you are implementing or not implementing in a specific relational database, see this comparative tableen.