数据库原理实验报告 联系客服

发布时间 : 星期六 文章数据库原理实验报告更新完毕开始阅读

from stores

select *

from titleauthor

select title_id,title from titles

select title from titles

where price>15 and price<18

select title_id,title from titles

where title like 'T%'

select title_id,title,pub_id from titles

where pub_id<1000

select price,title from titles

where price<16 and title like 'T%'

select title_id,title,price from titles

where title not like 'T%' and price>16

select title_id,title,price from titles

where title not like 'T%' and price<=16

select pub_name,title from titles,publishers where =

select au_lname,au_fname,title from authors,titleauthor,titles where = and =

select city,title

from titles,publishers

where =

select au_fname,au_lname,phone from authors

order by au_fname,au_lname

select title,price from titles

order by price desc

select title,price from titles

order by price asc

select COUNT(distinct type) as 书的种类 from titles

select COUNT(distinct price) as 定价种类 from titles

select title,price from titles

where price=(select min(price)from titles)

select title,price from titles

where price=(select max(price)from titles)

实验三 对象的建立与数据更新操作

一 实验要求

1 创建和修改对象 (1)创建表对象

按照下面的的结构与内容建两个关系。表名分别以S、T 开头,后面是建表人的学号(以下简记为T**、S** )。先用create table 命令建立表的初始结构,表T**的初始结构包括下面T**中前四个属性。然后再用alter table .add. 添加一个属性: QTY(库存量)。并插入相应的内容。

T** Title 计算机原理 C语言程序设计 数据库原理 计算机网络 Artificial intelligence Expert systems 软件工程 Fortran 程序设计 鲁廷璋 顾学峰 H3067 S2005 S5006 370 200 180 author 张一平 李华 王家树 高明 t_no S3092 H1298 D1007 S5690 D2008 price QTY 300 230 200 150 400 S**

T_no S3092 D1007 S5006 S5690 Page 304 280 315 300 pub-date 1986 1993 1987 1993 H1298 D2008 S2005 H3067 210 358 298 307 1989 1994 1995 1995 (2)用alter column.改变属性title 的长度。

(3)用子查询方式建新表。表名以ST 开头, 后面为建表人学号(简记为ST** )。 (新表内须包括title和price 两个属性。)

(4)按t_no 建索引,索引名为IT** (**表示建表人的学号,下同)。 (5)用子查询方式建视图,视图名为VT** , 并在视图上查找所需信息。 (6)删除以VT** 命名的视图。 (7)删除以ST** 命名的表。 2、记录的插入、删除与更新

(1)同前,用子查询方式建立表ST** 。该表的属性应有t_no, title, price。 (2)在ST** 表中插入一元组: S7028, Digital Image Processing, (3)删除书名为“Fortran 程序设计”的那个元组。 (4)删除书号以H 开头的元组。 (5)把书价调整到原来价格的95% 。

(6)把书号以D 开头的那些书的书价减掉元。 (7)将“计算机原理”的书号改为S1135。

(8)对所建的表,进行各种插入、删除、更新操作。

(9)每次修改表后,可用select 查看一下修改后表中的内容,看是否满足要求。 3、统计

(1)计算T** 表中这些书籍的最高书价、最低书价及平均书价。 (2)计算T** 表中的书的种类是多少。 (3)计算S** 表中1990年后出版的书有多少。 (4)计算总共有多少本书。

(5)对样例表,设计统计要求,获得各种统计量。