Wednesday, October 15, 2014

INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL)



INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL)

via an application. They are normally used by the DBA to a limited extent, a database designer or application developer. These statements are immediate i.e. they are not susceptible to ROLLBACK commands. It should also be noted that if several DML statements for example updates are executed then issuing any DDL command would COMMIT all the updates Structured Query Language (SQL) is a language that provides an interface to relational database systems. SQL was developed by IBM in the 1970s for use in System R, and is a de facto standard, as well as an ISO and ANSI standard. SQL is often pronounced SEQUEL.

In common usage SQL also encompasses DML (Data Manipulation Language), for INSERTING UPDATED, and DDL (Data Definition Language), used for creating and modifying tables and other database structures.

The development of SQL is governed by standards. The American National Standards Institute (ANSI) is that approves certain standards in many different industries. SQL has been deemed the standard language in relational database communication, originally approved in 1986 based on IBM's implementation. In 1987, the International Standards Organization (ISO) accepted the ANSI SQL standard as international standard. The standard was revised again in 1992 and was called SQL - 92. The newest is now called SQL 99, it is also referred to as SQL3. SQL3 support object, extensions and are partially implemented in Oracle8 and 9.

SQL has been a command language for communication with the Oracle. Oracle SQL contains many extensions. When an SQL statement is entered, it is stored in a part of memory called the SQL buffer and remains there until a new SQL statement is entered.

SQL *PLUS is an Oracle tool that recognizes and submits SQL statements to the Oracle Server for execution. It contains its own command language.

Features of SQL

SQL can be used by, a range of users, including those with little or no programming experience
It is a non procedural language
It reduces the amount of time required for creating and maintaining systems
It is an English like language

Features of SQL *PLUS

SQL *PLUS accepts ad hoc entry of statements
It accepts SQL input from files
It provides a line editor for modifying SQL statements
It controls environmental settings
It formats query results into basic reports
It accesses local and remote databases

Rules for SQL

SQL starts with a verb (i.e. a SQL action word). Example: SELECT statements. This verb may have additional adjectives. Example: FROM
Each verb is followed by number of clauses. Example: FROM, VMEREf HAVING
A space separates clauses. Example: DROP TABLE EMP;
comma (,) separates parameters without a clause
A is used to end SQL statements
Statements may be split across lines but keywords may not
Lexical units such as identifiers, operator names, literals are separated by one or more spaces or other delimiters that will not be confused with the lexical unit
Reserved words cannot be used as identifies unless enclosed with double quotes.
Identifiers can contain up to 30 characters and must start with an alphabet character.
Character and date literals must be enclosed within single quotes
Numeric literals can be represented by simple values such as 0.32, -34, 01991, and so on, scientific notation as 2E5 meaning 2 x 10 to the power of 5 = 200,000.
Comments may be enclosed between /* and */ symbols and may be multi line. Single line comments may be prefixed with a – symbol          

No comments: