Simple SQL Retrieval
暂无分享,去创建一个
SQL has one command for retrieving data: SELECT. This is nowhere as restrictive as it might seem. SELECT contains syntax for choosing columns, choosing rows, combining tables, grouping data, and performing some simple calculations. In fact, a single SELECT statement can result in a DBMS performing any or all of the relational algebra operations. In addition to these basic clauses, SELECT has many other syntax options. One of the characteristics of a relation is that any of the columns can be viewed in any order chosen. SQL therefore allows specifying the columns that are wanted and the order in which they are wanted to be seen. Unless specified otherwise, the rows in a result table appear in the order in which they are physically stored in the table. To change that order, an ORDER BY clause has to be added to the SELECT statement. As well as viewing any columns from a relation, any rows can also be viewed as required. The row selection criteria is specified in a SELECT statement's WHERE clause.