恒生电子实施技术笔试-2013
一、数据方面库库库
1、-- Create table 作者信息表create table AUTHORS
(
AU_ID NUMBER,
AU_NAME VARCHAR2(64),
PHONE VARCHAR2(64),
AGE NUMBER,
ADDRESS VARCHAR2(64),
CITY VARCHAR2(64),
STATE VARCHAR2(64),
ZIP VARCHAR2(64)
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
next 1
minextents 1
maxextents unlimited
);
2、-- Create table 书书书书籍存表
create table BOOKS
(
BOOK_ID NUMBER,
BOOK_NAME VARCHAR2(254),
AU_ID NUMBER,
TYPE VARCHAR2(64),
PRICE NUMBER,
QTY NUMBER
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64
next 1
minextents 1
maxextents unlimited
);
库库1库库库库库库库库库库库库库库库库库库库库库库库库库库库库示数据号、籍名称、作者号、作者姓名、作者、年信息
答:select b.book_id,b.book_name,a.au_id,a.phone,a.age
from authors a,books b
where b.au_id=a.au_id(+)
库库库库库库库库库库库库库库库库库库库库库库库库库库注:籍存表的作者可能在作者信息表里没有采用左接
库库2 库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库省份浙江省的个作者的所有籍的存量,,示作者号、存量字段,每
答:select t.au_id,sum(qty)
from books t
group by au_id
having au_id in (select au_id from authors);
注:如果要作者信息表作者的存量,添加库库库库库库库库库库库库库库库库库库库库库库库
having 子句
库库3 修改数据存表符合下列条件的籍的价格原来的库库库库库库库库库库库库库库库库库库库0.8倍:作者姓名:迅,库“库”库
答:update books set price=0.8*price
where au_id =(select au_id from authors where au_name='库迅');
注:如果作者信息表作者姓名有重,库库库库库库库库库库库库库库库库库库
where au_id in(select au_id from authors where au_name='库迅');
库库4 库库库库库库库库库库库库库库库库除作者信息表中符合下列条件的作者信息:其写的籍中,籍名称包含字符
‘oracle’且存量小于库库库库库100本的籍作者,库库库库库
答:delete from authors
where au_id in(
select au_id
from books
where book_name like '%oracle%' and qty<100
);
库库5 库库库库库库库库库库库库库库库库库库库库库库籍存表中作者个数,且些作者的年大于30库,
答:select count,*,
from books
where au_id in (select au_id from authors where age >30);库库6 用一个句完成下述任:根据存表籍号库库库库库库库库库库库库库库库库库库库N的籍存信息,在籍存表中库库库库库库库库库库库库库库
增加籍存信息,新增的籍号比原来的籍号大库库库库库库库库库库库库库库库库库库库库库库10000,存数量库库库库库0,
答:insert into books(book_id,book_name,au_id,type,price,qty)
select book_id+100,book_name,au_id,type,price,0 from books;
库库7 库库库库库库库库库库库籍存表中年大于30库或小于18库库库库库每个作者的存量(库库库库示作者的号、
年、存量三个字段库库库库库库库库库库),
答:select b.au_id,a.age,sum(qty)
from books b, authors a
where a.au_id=b.au_id
group by b.au_id,a.age having age>30 or age<18 库库8 列出符合下列条件的作者姓名:些作者既出籍名库库库库库库库库库库库"ABC" and "UFO"的,库库
答:select au_name from authors
where au_id in (select distinct au_id from books where
book_name='ABC' and book_name='UFO')库库9 列出符合下列条件的作者姓名:在籍存表中,些作者出的籍库库库库库库库库库库库库库“库库”库文学
存 数量大于自己出的籍库库库库库“库”库库库库库库库库库库史的的存数量,大于自己,
答:create tables wbook as select a.au_name ,b.au_id ,sum(qty)
from authors a, books b
where a.au_id=b.au_id
group by au_name,au_id,type
having type='文学'
alter table wbooks
add column_name lau_name vchar32(64)
add column_name lqty nuber;
create tables lbook as select a.au_name ,b.au_id
,sum(qty) from authors a, books b
where a.au_id=b.au_id
group by au_name,au_id,type
having type='文学'
update wbook lqty=(select qty from lbook where
wbook.au_id =lbook_id(+))
select a.au_name from authors a where au_id in (select
au_id from wbook where qty>lqty)
本文档为【恒生电子实施技术笔试-2013】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。