SQL Syntax - Some Useful Keywords

来源:互联网 发布:nodejs 定义二维数组 编辑:程序博客网 时间:2024/06/06 16:49

1. SELECT TOP Clause

--TOP used to specify the number of records to return,SQL SERVERSELECT TOP number|percent colNameFROM tableName;

--MySQLSELECT colNameFROM tableNameLIMIT number;

2. Like pattern

%   A substitue for zero or more characters

_ A substitue for a single character

[charlist] Sets and ranges of characters to match

[^charlist] or [!charlist] Matches only a character NOT specified within the brackets


3. IN OPERATOR

SELECT colNameFROM tablenameWHERE colname IN(val1, val2, val3,...)

4. Between 

SELECT colNameFROM tablenameWEHRE colName (NOT)BETWEEN val1 AND val2;

5. SQL Aliases

--SQL Alias Syntax for columnsSELECT colName AS aliasNameFROM tablename

--SQL ALias Syntax for TablesSELECT colnameFROM TableName AS alias_name;



0 0
原创粉丝点击