表单的管理作业及答案
版权声明:原创作品,谢绝转载!否则将追究法律责任。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1.在查询分析下创建数据库yry,及三张表childs、fathers、mothers
childs
Mothers
Fathers
2.为fathers表添加工作单位一列,并输入相应工作单位:
张三 中国电信
王五 教育局
3. 删除 Mothers QQ一列
4,;将childs表 名字为毛毛的出生时间改为
5,将Mothers表所有的年龄都增长一岁
6,删除childs表中的“兵兵”所有的数据
答案
on (name=t_data,filename='e:\t_data.mdf', size=1mb,maxsize=100mb, filegrowth=1mb) log on (name=t_log,filename='e:\t_log.ldf', size=1mb,maxsize=100mb, filegrowth=1mb) go ---------创建第一张childs表 use yry create table childs (name varchar (10) not null, 出生日期 smalldatetime , age int, sex char (2), 学费 smallmoney , 家庭住址 varchar (50), fathername varchar (10), mothername varchar (10)) go ------------更改sex类型为bit-------- use yry alter table childs alter column sex bit go ------------更改age的int为tinyint
use yry alter table childs alter column age tinyint go -----------添加表里的内容------ use yry insert into childs values ('毛毛','2006-1-1', 2, 1, 100.10 ,'武汉三层楼特1号','张三', '李四') insert into childs values ('豆豆','2006-10-1', 2, 0, 102.23 ,'汉口青年家园8号','王五', '马六') insert into childs values ('兵兵','2006-9-2', 2, 1, 156.23 ,'湖南',null, '赵八') go -----------创建mothers表------
use yry create table mothers (name varchar (10), age tinyint , qq int, tel char (12), address char (4)) go -------------为mothers表添加信息-------- use yry insert into mothers values ('李四', 27, 123456, '027-12345678', '商场') insert into mothers values ('马六', 28, 678909, '021-12345678', '工商') insert into mothers values ('赵八', 26, 123456, 13912345678, '学校') go -------------建fathers表------- use yry create table fathers (name varchar(10) not null, age tinyint, tel varchar (12), address char (10)) ---------给表中添加数据--- use yry insert into fathers values ('张三', 29 ,'0716-23456', '公安') insert into fathers values ('王五', 30 ,'0726-23456', '银河') go ------------为fathers添加工作单位
use yry alter table fathers add 工作单位 varchar (10) go update fathers
set 工作单位='中国电信' where name='张三' go update fathers
set 工作单位='教育局' where name='王五' go ------删除 Mothers QQ一列----- use yry alter table mothers drop column qq go -------将childs表 名字为毛毛的出生时间改为2005-10-1
use yry update childs set 出生日期='2005-10-1' where name='毛毛' go ----将Mothers表所有的年龄都增长一岁---
update mothers set age=age+1 go ------------删除childs表中的“兵兵”所有的数据----- delete from childs where name='兵兵' go 本文出自 “cxxtjh” 博客,谢绝转载! 本文出自 51CTO.COM技术博客 |


cxxtjh
博客统计信息
热门文章
最新评论
友情链接