欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

nosql期末考試試卷,nosql數(shù)據(jù)庫期末題庫答案

數(shù)據(jù)庫期末考試題 編寫SQL語句 1.創(chuàng)建一張學生表,包含以下信息,學號,姓名,年齡,性別,家庭住址,聯(lián)系

create table 學生表

為坡頭等地區(qū)用戶提供了全套網(wǎng)頁設計制作服務,及坡頭網(wǎng)站建設行業(yè)解決方案。主營業(yè)務為成都做網(wǎng)站、網(wǎng)站設計、坡頭網(wǎng)站設計,以傳統(tǒng)方式定制建設網(wǎng)站,并提供域名空間備案等一條龍服務,秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!

(

學號 char(10) primary key,

姓名 char(10),

年齡 int,

性別 char(2) check (sex IN ('男','女')),

家庭住址 char(40),

聯(lián)系 char(20)

)

SQL數(shù)據(jù)庫面試題 急急急

a)select pname as '商品名',avg(qty) as 平均銷售量 from s,p,m where m.city='上海' and s.mno=m.mno and p.pno=s.pno,select p.Pno,p.pname,sum(s.qty)

from s left join p on s.pno=p.pno left join m on p.Mno=m.Mno

where m.city='上海市'

group by p.Pno,p.pname,p.city,p.color

b)、先刪除Sale表的外鍵PNO,再刪除gds表。

c)聯(lián)系:視圖(view)是在基本表之上建立的表,它的結構(即所定義的列)和內(nèi)容(即所有數(shù)據(jù)行)都來自基本表,它依據(jù)基本表存在而存在。一個視圖可以對應一個基本表,也可以對應多個基本表。視圖是基本表的抽象和在邏輯意義上建立的新關系

區(qū)別:1、視圖是已經(jīng)編譯好的sql語句。而表不是

2、視圖沒有實際的物理記錄。而表有。

3、表是內(nèi)容,視圖是窗口

4、表只用物理空間而視圖不占用物理空間,視圖只是邏輯概念的存在,表可以及時四對它進行修改,但視圖只能有創(chuàng)建的語句來修改

5、表是內(nèi)模式,視圖是外模式

6、視圖是查看數(shù)據(jù)表的一種方法,可以查詢數(shù)據(jù)表中某些字段構成的數(shù)據(jù),只是一些SQL語句的集合。從安全的角度說,視圖可以不給用戶接觸數(shù)據(jù)表,從而不知道表結構。

7、表屬于全局模式中的表,是實表;視圖屬于局部模式的表,是虛表。

8、視圖的建立和刪除只影響視圖本身,不影響對應的基本表。

面試題目(sql)

1、忍不住想說一句,因為第一題中的字段類型是

【日期型】,而各種數(shù)據(jù)庫操作日期型數(shù)據(jù)有不同的方法,沒有一種共通的方法,所以脫離了數(shù)據(jù)庫而言沒有一種共通的sql。

2、select

ID,NAME,ADDRESS,PHONE,LOGDATE

from

T

where

ID

in(

select

ID

from

T

group

by

NAME

having

count(*)1)

order

by

NAME;

3、delete

from

T

where

ID

not

in

(select

min(id)

from

T

group

by

name);

4、update

T

set

T.ADDRESS=(select

E.ADDRESS

from

E

where

E.NAME=T.NAME),

T.PHONE=(select

E.PHONE

from

E

where

E.NAME=T.NAME);

5、這個不同的數(shù)據(jù)庫也有不同的處理方法,不能脫離數(shù)據(jù)庫談了。

如:SqlServer或者access可以使用

top

oracle可以使用

rownum

---

以上,希望對你有所幫助。

SQL數(shù)據(jù)庫試題求解

------------------------------------------------------

create table students(st_id varchar(20),st_name varchar(50),sex varchar(10))

insert into students(st_id,st_name,sex)

select 'st001','張杰', '男' union all

select 'st002', '公孫燕飛' ,'男' union all

select 'st003', '王楠', '女' union all

select 'st004', '王偉', '男' union all

select 'st005','李燕紋', '女' union all

select 'st006', '孫武' ,'男'

select *

from students

create table teachers(t_id varchar(20),t_name varchar(50),t_lesson varchar(50))

insert into teachers

select 't001', '張老師' ,'數(shù)學' union all

select 't002', '李老師', '英語'

delete from results

create table results(r_id varchar(20),r_fenshu int,r_stid varchar(50),r_tid varchar(50))

insert into results

select 'r001','90', 'st001', 't002' union all

select 'r002', '68', 'st005', 't001' union all

select 'r003', '92', 'st003' ,'t001' union all

select 'r004', '82', 'st006', 't002' union all

select 'r005', '70', 'st002', 't002' union all

select 'r006', '86', 'st002', 't001' union all

select 'r007', '57', 'st003', 't002' union all

select 'r008', '76', 'st006', 't001' union all

select 'r009', '55', 'st001', 't001' union all

select 'r010', '77', 'st004', 't002' union all

select 'r011', '58', 'st005', 't002'

----------------------------------------------------------

1.

select st_id

from students

where st_name = '王偉'

2.select st_id,st_name

from students

where st_name like '__燕%'

3 select st_name,len(st_name) as 名字長度

from students

where sex ='男'

4 select min(r_fenshu) as 最低分數(shù)

from teachers t inner join results r on t.t_id =r.r_tid

where t_lesson ='數(shù)學' --這個是不考慮成績中有null值的

5 select s.st_id as 學生編號,r_fenshu as分數(shù),r_tid as 課目號

from students s inner join results r on s.st_id =r.r_stid

where s.sex='女'

--如果還要課目的名稱的話請用下面的

select s.st_id as 學生編號,r.r_fenshu as 分數(shù),r.r_tid as 課目號,t.t_lesson as 課目名稱

from students s inner join results r on s.st_id =r.r_stid

inner join teachers t on r.r_tid = t.t_id

where s.sex='女'

6 select avg(r.r_fenshu)

from results r inner join teachers t on r.r_tid = t.t_id

where t.t_lesson='英語'

7.select *

from students s inner join results r on s.st_id =r.r_stid

inner join teachers t on r.r_tid = t.t_id

where s.st_id in (select top 2 st_id from students order by st_id desc)

order by s.st_id desc

8 select sum(r.r_fenshu) as 總分

from results r inner join students s on r.r_stid =s.st_id

where s.st_name = '王楠'

9.select distinct s.st_id,s.st_name

from students s inner join results r on s.st_id = r.r_stid

where st_id not in (select r_stid from results where r_fenshu60) and st_id not in (select r_stid from results where r_fenshu =90)

10 update results

set r_fenshu = r_fenshu + 10

--如果分數(shù)不可能大于100請用這句 set r_fenshu = case when r_fenshu + 10 =100 then r_fenshu + 10 else 100 end

where r_stid in (select st_id from students where sex='女')

1 進階題

select t.t_name,count(*)

from students s,teachers t,results r

where r.r_tid = t.t_id

and s.st_id =r.r_stid

and r.r_fenshu = 60

and t.t_id in (select t_id from teachers where t_lesson='數(shù)學' )

--and t_lesson='數(shù)學'

group by t.t_name

2

select top 1 sum(r_fenshu) as 總分,t.t_lesson,t_id,t_name

from results r,teachers t

where r.r_tid = t.t_id

group by t.t_lesson,t_id,t_name

order by 總分 desc

3. delete from results where r_stid in (select r_stid from results group by r_stid having count(r_tid) = 1)

1 選做題

select d.name from sysobjects d where d.xtype='U'

2.select top 5 * from students order by newid()

網(wǎng)頁名稱:nosql期末考試試卷,nosql數(shù)據(jù)庫期末題庫答案
URL鏈接:http://chinadenli.net/article32/dsioesc.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名網(wǎng)站制作Google網(wǎng)站建設搜索引擎優(yōu)化網(wǎng)站收錄

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

h5響應式網(wǎng)站建設