--插入
insert into test(lastname,firstname)values('yan','xu')
--更新,修改
update test
set firstname='Xu',title='the center of computer',region='XA',country='CH',city='XI AN'
where employeeid=10
--平均值
select avg(employeeid) as 平均值 from test
--將小寫的字符數據轉化為大寫,lower相反
select upper(lastname)as mingzifrom test
where employeeid='1'
select getdate() --用getdate()函數獲取當前系統的時間
--從getdate()返回的日期中提取月份數,可以用同樣的方法提取年,日--
select datepart(month,getdate()) as 'month number'
--復制表--
select * into test
from Northwind.dbo.CategorIEs
--取最大值--
select max(id) as Max_ID from customer
--返回employees表中首列的名稱
select col_name(object_ID('employees'),1)
--取出列並重命列名的兩種方法(用as和不用as)
select au_lname "Author last name" from authors
select au_lname as 'Author last name' from authors
--查詢結果執行運算
select price "Original price",price*2 "New price" from titles
select price,ytd_sales,price*ytd_sales "Total revenue" from titles
--使用連接運算符(它看起來像個加號)來連接兩個字符型字段
select