Wednesday, 23 January 2019

Introduction of SQL


Structured Query Language (SQL) is a specialized language for updating, deleting, and requesting
information from databases. SQL is an ANSI and ISO standard, and is the de facto standard database query
language. A variety of established database products support SQL, including products from Oracle and
Microsoft SQL Server. It is widely used in both industry and academia, often for enormous, complex
databases.

In a distributed database system, a program often referred to as the database's "back end" runs constantly on
a server, interpreting data files on the server as a standard relational database. Programs on client computers
allow users to manipulate that data, using tables, columns, rows, and fields. To do this, client programs send
SQL statements to the server. The server then processes these statements and returns replies to the client
program.
SQL is a standardized query language for requesting information from a database. The original version
called SEQUEL (structured English query language) was designed by an IBM research center in 1974 and
1975. SQL was first introduced as a commercial database system in 1979 by Oracle Corporation.
Historically, SQL has been the favorite query language for database management systems running
on minicomputers and mainframes. Increasingly, however, SQL is being supported by PC database systems
because it supports distributed databases (databases that are spread out over several computer systems). This
enables several users on a local-area network to access the same database simultaneously.
 SQL can execute queries against a database
 SQL can retrieve data from a database
 SQL can insert records in a database
 SQL can update records in a database
 SQL can delete records from a database
 SQL can create new databases
 SQL can create new tables in a database

 SQL can create stored procedures in a database
 SQL can create views in a database
 SQL can set permissions on tables, procedures, and views
The most common operation in SQL is the query, which is performed with the
declarative SELECT statement. SELECT retrieves data from one or more tables, or expressions. Standard
SELECT statements have no persistent effects on the database. Some non-standard implementations
of SELECT can have persistent effects, such as the SELECT INTO syntax that exists in some databases.
Queries allow the user to describe desired data, leaving the database management system
(DBMS) responsible for planning, optimizing, and performing the physical operations necessary to produce
that result as it chooses. A query includes a list of columns to be included in the final result immediately
following the SELECT keyword. An asterisk ("*") can also be used to specify that the query should return
all columns of the queried tables. SELECT is the most complex statement in SQL, with optional keywords
and clauses that include:
 The FROM clause which indicates the table(s) from which data is to be retrieved. The FROM clause can
include optional JOIN sub clauses to specify the rules for joining tables.
 The WHERE clause includes a comparison predicate, which restricts the rows returned by the query.
The WHERE clause eliminates all rows from the result set for which the comparison predicate does not
evaluate to True.
 The GROUP BY clause is used to project rows having common values into a smaller set of
rows. GROUP BY is often used in conjunction with SQL aggregation functions or to eliminate duplicate
rows from a result set. The WHERE clause is applied before the GROUP BY clause.
 The HAVING clause includes a predicate used to filter rows resulting from the GROUP BY clause.
Because it acts on the results of the GROUP BY clause, aggregation functions can be used in
the HAVING clause predicate.
 The ORDER BY clause identifies which columns are used to sort the resulting data, and in which
direction they should be sorted (options are ascending or descending). Without an ORDER BY clause,
the order of rows returned by an SQL query is undefined

No comments:

Post a Comment