SQL 增刪改查 簡單應用 熟悉掌握

2021-10-25 01:14:06 字數 838 閱讀 2615

– 查詢使用者表中所有的資料

– select * from users;

– 只查詢使用者的使用者名稱和密碼

– select username,password from users;

– 新增

– insert into users (username,password) values(『moana』,『1234』);

– select * from users;

– 更新

– update users setpassword=12345,status=1 where id=3;

– 刪除

– delete from users where id=4

– 篩選出id不等3的列表項

– select * from users where id<>3;

– select *from users where id=1 andstatus=0;

– select * from users where username=『zjm』 orstatus=1

– 降序

– select * from users order by id desc

– 公升序(如果密碼有同樣的,可以再按照id 的降序排序)

– select * from users order bypassword,id desc;

– 統計符合篩選條件的 數量

select count(*) as total from users wherestatus=0;

SQL學習 簡單增刪改查

刪改 查create table aa pkid intidentity 1 1 not null docid uniqueidentifier null name nvarchar 50 not null insert into aa values newid 張三 newid 李四 pkid,i...

SQL 增刪改查

之前大致了解過,現在用 mysql 的還是居於多數,而且自己之後也有意嚮往大前端發展,所以就需要撿起以前的 sql,也希望將來有機會用 node.js mysql 做大型專案的機會。因此,就從簡單的 sql 的增刪改查開始大前端之路。開發中最常見的就是 select 查詢。簡單的查詢,看起來是這樣的...

SQL增刪改查

1 增 insert into table name values value1,value2,insert into table name 列1,列2,values 值1,值2,2 刪 delete from table name where 列名稱 值 3 改 update table name...