What is SQL?
Structured Query Language... designed for managing data held in a relational database management systems..
Queries
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 SELECTstatements 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.- The
FROMclause which indicates the table(s) from which data is to be retrieved. TheFROMclause can include optionalJOINsubclauses to specify the rules for joining tables. - The
WHEREclause includes a comparison predicate, which restricts the rows returned by the query. TheWHEREclause eliminates all rows from the result set for which the comparison predicate does not evaluate to True. - The
GROUP BYclause is used to project rows having common values into a smaller set of rows.GROUP BYis often used in conjunction with SQL aggregation functions or to eliminate duplicate rows from a result set. TheWHEREclause is applied before theGROUP BYclause. - The
HAVINGclause includes a predicate used to filter rows resulting from theGROUP BYclause. Because it acts on the results of theGROUP BYclause, aggregation functions can be used in theHAVINGclause predicate. - The
ORDER BYclause identifies which columns are used to sort the resulting data, and in which direction they should be sorted (options are ascending or descending). Without anORDER BYclause, the order of rows returned by an SQL query is undefined.
No comments:
Post a Comment