首页 > 代码库 > SQL for beginner
SQL for beginner
http://www.codeceo.com/article/15-basic-sql-for-beginner.html
create table,
insert into ... values()
简单select查询
select
合计与标量
count, avg, max, min, sum
ucase, lcase, substring, len, round
select * from ItemMasters-- Aggregate-- COUNT() -> returns the Total no of records from table , AVG() returns the Average Value from Colum,MAX() Returns MaX Value from Column-- ,MIN() returns Min Value from Column,SUM() sum of total from ColumnSelect Count(*) TotalRows,AVG(Price) AVGPrice,MAX(Price) MAXPrice,MIN(Price) MinPrice,Sum(price) PriceTotalFROM ItemMasters-- Scalar-- UCASE() -> Convert to Upper Case ,LCASE() -> Convert to Lower Case,-- SUBSTRING() ->Display selected char from column ->SUBSTRING(ColumnName,StartIndex,LenthofChartoDisplay)--,LEN() -> lenth of column date,-- ROUND() -> Which will round the valueSELECT UPPER(Item_NAME) Uppers,LOWER(Item_NAME) Lowers,SUBSTRING(Item_NAME,2,3) MidValue,LEN(Item_NAME) Lenths,SUBSTRING(Item_NAME,2,LEN(Item_NAME)) MidValuewithLenFunction,ROUND(Price,0) as RoundedFROM ItemMasters
日期函数
其它 select函数
top, order by, distinct,
Where子句
where in, where between,
Group by 子句
having
子查询
where
连接查询
join
Inner Join,Left Outer Join,Right Outer Join and Full outer Join
union合并查询
公用表表达式(with)
视图
pivot行转列
存储过程
函数function
SQL for beginner
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。