1. update
update table_name set column_name = value_new where ...
tips: 更新多個值,用逗號分隔
2. delete
deletefrom table_name where ...
tips: 刪除全部資料
deletefrom table_name
3. top
selecttop3
*from
table_name
select
top30
percent
*from table_name
4.萬用字元
'%' - 乙個或多個字元
'_' - 乙個字元
'[abc]' - abc 中任意單字元
'[^abc]' - 不在abc 中的任意單字元
tips:
查詢目標為null 時 用 is null
select*from table_name where column_name is null
查詢目標為空值是用 ''
select*from table_name where column_name like
''
5. in - 多個值,
between…and - 之間的數值,文字或日期
select*from table_name where column_name in
(value1, value2)
select
*from table_name where column_name between value1 and value2 order
bycolumn
select
*from table_name where column_name not
between value1 and value2
6. alias
tips: 表的alias
select column_name from table_name as alias_name
列的alias
select column_name as alias_name from table_name
SQL SERVER 基礎語句學習 三
1.join tips 1 inner join 同 join select alias name1.column name,alias name2.column name from table name1 as alias name1 inner join table name2 as alias...
SQL Server 基礎 SQL語句
本文列舉的一些常用的sql語句,從四類資料庫操作語言入手。增 insert into 表名 列1,列2,values 值1,值2,刪 delete from 表名 where 列名稱 值改 update 表名 set 列名 where 列名稱 某值查 基本格式 select 查詢內容 from 查詢...
SQL Server中語句的查詢基礎
首先建立資料庫各種語句的查詢 1 語法格式 select from authors 代表所有列,沒有where子句代表所有行 select authorname,email,age 多個列名間用逗隔開 from authors where age 20 order by age desc,autho...