oracle資料庫的增刪改查

2022-09-13 00:33:26 字數 951 閱讀 6681

增:

①增加部分字段:insert into table (欄位1,欄位2)values(v1,v2)

②增加全部字段:insert into table values(v1,v2)

刪:delete * from table where id='123'

改:①修改部分字段:update  table set  字段='value' where id='123'

查:①條件查詢:select * from table where id='123'

②分頁查詢:

select a.* from (select   id , rownum rn from table )a where a.rn<10 and a.rn>5

函式:select  count (studentid) from  student  group by  classid;//查出每個班級的學生的數量;根據班級編號分組

select  stu.classname from  student stu ,(select  classid,count (studentid)  count from  student  group by  classid)b where stu.classid=b.classid order by b.count desc;//根據班級學生量倒敘查出班級名稱

select nickname,user_name,

case when user_rank = '5' then '經銷商'

when user_rank = '6' then '**商'

when user_rank = '7' then 'vip'

else '註冊使用者' end as user_rank

資料庫 Oracle 增刪改查(基礎)

select 欄位名 from 表名 where 條件 group by 欄位名 order by create table 表名 欄位名 資料型別 長度 欄位名 資料型別 長度 建立表 create table 表名 as select.拿來當備份 insert into 表名 欄位名1,欄位名2...

資料庫增刪改查

我們知道當我們的表建立後重複執行會出錯,一般我們會這麼處理 create table if not exists stuinfo 學了新建表我們還應該知道乙個東西,如何刪除表 deop table table name 怎麼檢視別人的見表語句呢 show create table stuinfo 怎...

資料庫增刪改查

import pymysql def getmysqlconn conn pymysql.connect host 172.16.238.130 port 3306,db my mysql user root password 123456 charset utf8 return conn def ...