SQL is a database language for defining data structures in relational databases and to edit, insert, modify, delete data and serve query based on saved data. It is just a beginners guide, you can read or follow Pinal Dave’s writings for mastery on SQL. Probably he has the highest number of single person authored writings on SQL counting more than 2200. The SQL language is based on the relational algebra, its syntax is relatively simple and semantically similar to the English vernacular in logic. Almost all current database systems support SQL – albeit to varying degrees and with slightly different dialects.
Basics of SQL Language
The name SQL is in common usage as an abbreviation for “Structured Query Language”, although it is an independent name, according to the standard. The name is derived from its predecessor SEQUEL. SQL commands can be divided into three categories :
- (DML) commands for manipulating data (change, insert, delete etc.)
- (DDL) commands for defining the database schema
- (DCL) commands for right management and transaction control
Queries with the data is stored in a database to retrieve data, so the user or the application can use it. Each DBMS vendor has extended the list of commands. For static SQL, the SQL statement is the database system at the time of the translation program is known and is fixed (for example, if the query of an account is pre-formulated and is the term used only the account number). For dynamic SQL, the SQL statement is the database system known only at the time of program execution (for example, if the user enters the entire query). For example, all SQL statements that are using SQL / CLI or JDBC are always executed dynamically. Executed dynamic SQL statements in general execute immediately.Advertisement
For dynamic SQL, the database system has to interpret the SQL statement for the duration of the program and has to optimize the access path. Since this so-called parsing process takes time to buffer, many database systems has parsed SQL statements, so that if they are repeated, they save the time for re-parsing.
SQL : Simple Examples
Simplest query is :
SELECT * FROM this;
This Lists all columns, and all rows from the table named this. You can see some examples in RDBMS in Indispensable MySQL queries for custom fields in WordPress.