1、增
insertinto table_name values
(value1, value2,....)
insert
into table_name (列1, 列2,...) values (值1, 值2,....)
2、刪
deletefrom table_name where 列名稱 = 值
3、改
update table_name set 列名稱 = 新值 where 列名稱 =某值update person set firstname =
'fred
'where lastname =
'wilson
'update person set address =
'zhongshan 23
', city =
'nanjing
'where lastname =
'wilson
'
4、查
select 列名稱 from表名稱select
*from
表名稱select
distinct 列名稱 from 表名稱
5、條件
select 列名稱 from 表名稱 where列名稱 運算子 值
運算子:=等於
<>
不等於》
大於<
小於》=
大於等於
<=
小於等於
between
在某個範圍內
like 搜尋某種模式
請注意,我們在例子中的條件值周圍使用的是單引號。
sql 使用單引號來環繞文字值(大部分資料庫系統也接受雙引號)。如果是數值,請不要使用引號。
這是正確的:select * from persons where
firstname='bush'
這是錯誤的:select * from persons where
firstname=bush
這是正確的:select * from persons where
year>1965
這是錯誤的:select * from persons where
year>'1965'
引自:
SQL 增刪改查
之前大致了解過,現在用 mysql 的還是居於多數,而且自己之後也有意嚮往大前端發展,所以就需要撿起以前的 sql,也希望將來有機會用 node.js mysql 做大型專案的機會。因此,就從簡單的 sql 的增刪改查開始大前端之路。開發中最常見的就是 select 查詢。簡單的查詢,看起來是這樣的...
sql增刪改查語法
1.使用insert插入單行資料 語法 insert into 表名 列名 values 列值 例 insert into strdents 姓名,性別,出生日期 values 斌 男 1993 6 15 注意 into可以省略 列名列值用逗號分開 列值用單引號因上 如果省略表名,將依次插入所有列 ...
SQL 增刪改查(具體)
一 增 有3種方法 1.使用insert插入單行資料 insert into 表名 列名 values 列值 insert into strdents name,age values atm 12 2.使用insert,select語句將現有表中的 資料加入到已有的新錶中 insert into 已...