notes/tips during sql tutorial learning
来源:互联网 发布:淘宝买家举证假货 编辑:程序博客网 时间:2024/05/03 07:23
below are some notes/tips during learning sql @ http://www.w3schools.com/SQl/sql_syntax.asp
1. Keep in mind that sql is not case sensitive
2. The DISTINCT keyword is used to return only distinct(different) values. It's syntax is , for example:
select DISTINCT City from Persons
3. The BETWEEN keyword can be used to select a range of data between two values, the syntax is
SELECT column_names
FROM table_name
WHERE column_name
[NOT]BETWEEN value1 AND value2
To select the data out of the range, NOT BETWEEN can be used.
Note: BETWEEN is treated differently in diff DB implementations:
1. some will exclude the range values
2. some will include the range values
3. some will include the first range and exclude the second range.
4. ORDER BY is used to sort the result:
SELECT column_name(s)
FROM table_name
[WHERE column_name]
ORDER BY column_name(s) ASC|DESC
5. GROUP BY is used in conjunction with aggregate function to group the result-set by one or more columns:
SELECT column_name(s),aggregate_function(column_name)
FROM table_name
[WHERE column_name(s)]
GROUP BY column_name(s)
6. INSERT INTO:
INSERT INTO table_name
VALUES(value1,value2,valuen)
INSERT INTO table_name(column1,column2,columnn)
VALJUES(value1,value2,valuen)
7. UPDATE:
UPDATE table_name
SET column1=value1,column2=value2,columnn=valuen
[WHERE column_name]
Note: if WHERE clause is omitted, all records will be updated.
8. DELETE:
DELETE from table_name
[WHERE column_name(s)]
Note: if WHERE clause is omitted,all records will be deleted.
9. SQL wildcards
wildcards must be used in LIKE operator
% : zero or more any characters
_ : one single character
[charlist] : any one character in the list
[^charlist] | [!charlist] : any one character not in the list
10. LIKE:
SELECT column_name(s)
FROM table_name
WHERE column_name LIKE pattern
- notes/tips during sql tutorial learning
- Tinyos tutorial learning tips -- lesson 1
- Tinyos tutorial learning tips -- lesson 2
- Tinyos tutorial learning tips -- lesson 3
- Tinyos tutorial learning tips -- lesson 4
- Tinyos tutorial learning tips -- lesson 5
- Tinyos tutorial learning tips -- lesson 6
- Tinyos tutorial learning tips -- lesson 7
- Tinyos tutorial learning tips -- lesson 8
- PL/SQL LEARNING NOTES(1)
- Learning Notes
- learning tutorial
- notes Hunspell Tutorial
- LEARNING NOTES FROM DEEP LEARNING
- ASP.net Learning notes
- Some C Learning Notes
- UliPad Learning Notes
- HTML Learning Notes
- ubuntu增加新分区
- linux磁盘配额quota的认识与实例
- c# 中调用windowsAPI
- Flex精华摘要--基本MXML功能
- 传智播客Spring视频教程学习笔记12
- notes/tips during sql tutorial learning
- 基于springmodules的缓存方案
- 母版页概述
- 传智播客Spring视频教程学习笔记13
- 从 C++ 模板元编程生产质数看 F# 函数式编程思想
- .IDL文件
- java小技巧共享(单例的惰性初始化)
- LINUX 的常用符号
- 泛型算法系列10:copy()&©_backward()