資料庫問題,這幾條SQL語句怎麼寫考研要用,急急急

時間 2021-11-04 14:10:13

1樓:

第一個這樣寫試試:select color,count(*) from p group by color;

第二個:select nvl(spj.jno,0) from j,spj where j.jno(+) = spj.jno;

第四個:你先select * from p where color = '紅色';如果能查到結果的話就證明是後面那句話寫的不對,然後再查select * from p where color = '紅色' and weight>10;先看weight欄位的型別是什麼,如果是warchar2和number型別的以上這樣寫都沒錯;

第五個:grant select on s to u1;

第六個:revoke insert on table p from u2 cascade;

2樓:匿名使用者

找出各種顏色的零件數量

select p.color,sum(spj.qty) from p,spj where p.pno=spj.pno group by color

3樓:匿名使用者

嗨,哥們,我們好像考一個學校。是北京工業大學的管理科學與工程專業吧

急急急!!!怎麼用sql語句查詢student表中年齡最小的前三名學生資訊?

4樓:匿名使用者

select top 3 * from student order by age asc

top 3 是前3個學生的意思, order by age asc 的意思是根據年齡升序排列, 也就是說最前面的就是年齡最小的。 (當然你沒有考慮到的是3個最小的年齡一樣的話, 是不是還要加個條件, 比如學號, 性別)

5樓:匿名使用者

select top 3 * from student order by 年齡 asc

6樓:匿名使用者

hjghghgjhgjh

資料庫原理選擇題,麻煩幫忙解答,懸賞不是很多,急急急急!!!!!!

7樓:匿名使用者

1-5 cbaab 6-10 baada11-15 cccaa

1.隔離服務

2.訪問控制機制

3.防火牆

4.基於圖形使用者介面 (gui) 的工具 和 命令列實用工具 dta.exe

5.create table ,create view, create index

6.drop table,alter table

急急急,sql查詢一個欄位是否存在某一個值,怎麼寫查詢語句? 5

8樓:匿名使用者

select * from `表名` where locate('2',`fubclass`);

9樓:匿名使用者

where fubclass regexp '2'查詢2的記錄

where fubclass regexp '3' 查詢3的記錄

正規表示式其實也是like,不知道滿足你的要求不

10樓:匿名使用者

'sql server使用

bai:

select * from 表名

duzhi as a where instr(a.fubclass,"2")>0

oracle 使用:

select * from 表名 as a where instr(a.fubclass,'2')>0

以上dao

作用是查詢表名的fubclass欄位專包含2的記屬錄集

11樓:

不知道是什bai麼資料庫..

oracle資料庫sql語句如下du:

select * from 表名 where instr(fuclass,'你要傳zhi入的引數')>0;

其實這dao

樣也有問題,你這題的內思路應該是

先根據逗號容分隔符擷取字串,然後根據你傳入的引數和根據逗號擷取出來的字串進行比較,如果存在那就是你要的記錄,否則就不是,但是oracle並不存在這樣一種函式.比如gp中使用的split_part函式,所以比較麻煩,只能自己構建一個函式,然後呼叫這個函式先對字串進行處理

出問題的原因是如果你傳入一個'2',那麼'22'也會算作是合格字元,而將結果返回

12樓:匿名使用者

select * from xx,where fubclass like '%2%'

select * from xx,where fubclass like '%3%'

13樓:匿名使用者

create proc test_op

@canshu char(20)

asbegin

select *from 表名 where fubclass like '%'+rtrim(@canshu)+'%'

end--exec test_op '2'

14樓:匿名使用者

什麼資料庫?select * from 表名 where fubclass like "%2%";

SQL資料庫查詢語句問題

簡單點說 inner join 就是 只把連線的表中的資料符合鏈結條件的顯示出來 leftjion 是上面的基礎上 把左邊的表上不符合鏈結條件的資料顯示出來 rightjion 是在innerjoin的基礎上把右邊表的不符合條件的資料顯示出來 還有個fulljoin 把兩邊所有的資料都列出來 舉個例...

sql資料庫使用者驗證語句,SQL資料庫使用者驗證語句

sql語句 select from tablename where userid userid and userpwd userpass 要不寫在儲存過程裡 set ansi nulls on set quoted identifier on goalter procedure dbo loginp...

SQL查詢語句的問題,acess資料庫

select name,xuehao,sum chengji1 sum chengji2 sum chengji3 sum chengji4 from student group by name name是名字 xuehao是學號 chengji是成績 前提條件,每個學生的每科成績是唯一的!否則,這...