您的位置:首页 > 数据库

SQL Syntax - Some Useful Keywords

2014-04-11 01:07 232 查看
1. SELECT TOP Clause

--TOP used to specify the number of records to return,SQL SERVER
SELECT TOP number|percent colName
FROM tableName;
--MySQL
SELECT colName
FROM tableName
LIMIT 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 colName
FROM tablename
WHERE colname IN(val1, val2, val3,...)

4. Between 
SELECT colName
FROM tablename
WEHRE colName (NOT)BETWEEN val1 AND val2;

5. SQL Aliases
--SQL Alias Syntax for columns
SELECT colName AS aliasName
FROM tablename
--SQL ALias Syntax for Tables
SELECT colname
FROM TableName AS alias_name;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  SQL