SQL (Structured Query Language)
SQL (Structured Query Language) is the most common standardized database language used to create, retrieve, access, modify, controland manage relational databases. SQL is a querying language exclusively designed for controlling data and managing databases effectively.
SQL was originally developed by IBM (International Business Machines Corporation) in the 1970's for their DB2 RDBMS. The team of developers included Andrew Richardson, Donald C. Messerly and Raymond F. Boyce. This first version was initially known as SEQUEL. It was basically used to modify and query the data stored in IBM's relational database product called System R. Later, SQL version 3 was officially defined by the American National Standards Institute (ANSI) in the ANSI SQL:1999 standard. Most existing DBMS's currently conform to the earlier ANSI SQL92 standard.
Majority of database management systems implement these standards and add their proprietary extensions. However, to be attuned with the ANSI standard, they all maintain the key commands such as SELECT, UPDATE, DELETE, INSERT, WHERE.
SQL helps in the retrieval, insertion, updating, and deletion of data from databases. A comprehensive database management system (DBMS) also comprises of managerial and administrative tasks. Oracle produces a procedural version of SQL which it calls PL/SQL. SQL is supported by every major database system in use today, including MySQL, PostgreSQL, Berkeley DB, Oracle, DB2, Sybase, Informix, and Microsoft SQL. SQL is often pronounced as "sequel".
Points to be Remembered about SQL
- It is an abbreviation for Structured Query Language.
- It helps in database access, control and manipulation.
- It is an ANSI (American National Standards Institute) standard.
- It is a nonprocedural database language.
- It is used with relational database management system (RDBMS) like MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
- It is not case sensitive i.e. writing ‘SELECT’ or ‘select’ means the same command.
- Depending on the database used, semicolons have to be attached at the end of SQL (Oracle requires semicolons whereas SQL Server do not)
Types of SQL statements
There are three primary types of SQL statements, which are as follows:
-
Data Definition Language (DDL) statements
Data definition language (DDL) statements helps the developer create, alter, and drop schema objects. It can grant and revoke privileges and roles from other database users. It examines information about a table, index, or cluster. It creates auditing options. It adds comments to the data dictionary.Examples of DDL statements
ALTER SEQUENCE, ALTER TABLE, COMMENT ON, CREATE ALIAS, CREATE, DISTINCT TYPE, CREATE FUNCTION, CREATE INDEX, CREATE PROCEDURE, CREATE SCHEMA, CREATE SEQUENCE, CREATE TABLE, CREATE TRIGGER, CREATE VIEW, DECLARE GLOBAL TEMPORARY TABLE, DROP ALIAS, DROP DISTINCT TYPE, DROP FUNCTION, DROP INDEX, DROP PACKAGE, DROP PROCEDURE, DROP SEQUENCE, DROP SCHEMA, DROP TABLE, DROP TRIGGER, DROP VIEW, GRANT DISTINCT TYPE, GRANT FUNCTION, GRANT PACKAGE, GRANT PROCEDURE, GRANT SEQUENCE, GRANT TABLE, LABEL ON, RENAME, REVOKE DISTINCT TYPE, REVOKE FUNCTION, REVOKE PACKAGE, REVOKE PROCEDURE, REVOKE SEQUENCE, REVOKE TABLE -
Data Manipulation Language (DML) statements
Data manipulation language (DML) statements access and manipulate data in the existing schema objects. These statements do not implicitly commit the current transaction.Examples of DML statements
CLOSE, COMMIT, DECLARE CURSOR, DELETE, FETCH, INSERT, LOCK TABLE, OPEN, REFRESH TABLE, RELEASE SAVEPOINT, ROLLBACK, SAVEPOINT, SELECT INTO, SET variable, UPDATE, VALUES INTO -
Dynamic SQL statements
Dynamic SQL statements are used at runtime.Examples of Dynamic statements
DESCRIBE, EXECUTE, EXECUTE IMMEDIATE, PREPARE
SELECT Statement
The SELECT statement is used to select data from a database. The result is stored in a result table, called the result-set.
Syntax
SELECT * FROM <table-name>
OR
SELECT <column-name>, [<column-name>,…] FROM <table-name>
Where ‘*’ refers to selection of all the available columns within the table <table-name>.
Example
SELECT * FROM Customer, SELECT CustomerID, CustomerName FROM Customer
WHERE Clause
The WHERE clause is used to select only those records that match a specified condition.
Syntax
SELECT <column-name>, [<column-name>,…] FROM <table-name> WHERE <column-name> <operator> <value>
Example
SELECT CustomerID, CustomerName FROM Customer WHERE CustomerCity = ‘Newyork’
Comments (1)
Leave a Reply
- How to Change the Language on an iPod
An iPod can display its settings in various languages and can be programmed to any language of choice. If you make a mistake and need to reset the language settings, just follow these simple instructions. They note the english name of the options to select, but also describe how to locate them even when you [...]...
- TL1 (Transaction Language 1)
TL1 (Transaction Language 1) is an element management protocol used primarily in the telecommunications industry. TL1 was designed by Bellcore (now Telecordia) in 1984 for use with its OSS (Operations Support System), NMA. TL1 is an MML (Man Machine Language), which means that TL1 messages should be readable and writeable by humans as well as [...]...
- Relational Database
A relational database stores data in separate tables instead of placing all data in one large table. It then allows Data Base Administrators (DBAs) to define relationships between these tables. These relationships enable DBAs to combine data from several tables for querying and reporting. This is accomplished through the use of keys, which are database [...]...
- Database Trigger
A database trigger is a procedural code that automatically changes information in one or more databases in response to a change on another database or table. For example, when an employer creates a slot in a list of employees for a new employee, the database trigger in that list should automatically add the new employee [...]...
- Database Normalization
Database normalization is the process of organizing data into distinct and unique sets. The purposes of normalization are to: Reduce or eliminate storage of duplicate data Organize data into an efficient and logical structure The process of normalization involves determining what data should be stored in each database table. By tradition, the process of normalization [...]...





give me more syntax of SQL…..tnxx:))