本帖最后由 xiewen 于 2013-7-27 17:31 编辑
--联系人表
create table user_touch
(
id int primary key identity(1,1),
name nvarchar(30) not null,
touch_num int references touch(id)
)
--联系方式表
create table touch
(
id int primary key identity(1,1),
phone varchar(11),
home_tel varchar(15),
company_tel varchar(15)
)
--向联系方式表插入数据
insert into touch values('15697553163',null,null)
insert into touch values('15814458712','0796-5552453',null )
insert into touch values('15678536685','0796-5853387',null)
insert into touch values('13845569569','010-16899736','0755-64569522')
insert into touch values('13717834951',null,null)
--向联系人表插入数据
insert into user_touch
select '谢文',2 union
select '曾亮',1 union
select '郑雄',3 union
select '吴楚耿',4union
select '肖楚',5
--------------查询只有一种联系方式的员工
|