先大体描述一下:
1.已知企业的职位要求表(比如:企业要求会JAVA,年龄35等等反正就是企业的要求)
2.已知人员基本信息表。(里面也包含自己主攻什么专业,薪资要求啦,自己的年龄啦等等)
业务需求:
在已知这2个表的基础上,现在企业要主动查询符合该企业的人员信息,请问我应该怎么做?
比如:现在企业要求查询符合该企业某职位要求的人员,要求为,计算机类别,.NET工作的人员,该人员等级高于三级,薪酬不超过5000的人的所有基本信息
- SQL code
USE [master]GO/****** 对象: Table [dbo].[Table_Emp] 脚本日期: 02/20/2012 15:36:09 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGOCREATE TABLE [dbo].[Table_Emp]( [Fid] [int] IDENTITY(1,1) NOT NULL, [FEmpName] [varchar](50) NULL, [Fsex] [char](10) NULL, [FHobby] [varchar](50) NULL, [FAge] [int] NULL, [FtypeID] [int] NULL, [FclassID] [int] NULL) ON [PRIMARY]GOSET ANSI_PADDING OFFGOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'姓名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Table_Emp', @level2type=N'COLUMN',@level2name=N'FEmpName'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'性别' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Table_Emp', @level2type=N'COLUMN',@level2name=N'Fsex'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'爱好' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Table_Emp', @level2type=N'COLUMN',@level2name=N'FHobby'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'年龄' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Table_Emp', @level2type=N'COLUMN',@level2name=N'FAge'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'从事方向ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Table_Emp', @level2type=N'COLUMN',@level2name=N'FtypeID'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'从事类别ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Table_Emp', @level2type=N'COLUMN',@level2name=N'FclassID'
--人员数据
1 张三 男 踢球 30 10301 20201
2 张三 男 音乐 30 10304 20202
3 张三 男 游泳 30 10302 20210
4 李四 男 读书 25 10304 20208
5 小红 女 音乐 25 10304 20202
- SQL code
USE [master]--企业要求表GO/****** 对象: Table [dbo].[Table_Ent] 脚本日期: 02/20/2012 15:36:27 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING ONGOCREATE TABLE [dbo].[Table_Ent]( [Fid] [int] IDENTITY(1,1) NOT NULL, [FEntName] [varchar](50) NULL, [FHobby_yaoqiu] [varchar](50) NULL, [FAge_yaoqiu] [int] NULL, [FtypeID_yaoqiu] [int] NULL, [FclassID_yaoqiu] [int] NULL) ON [PRIMARY]GOSET ANSI_PADDING OFFGOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'企业名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Table_Ent', @level2type=N'COLUMN',@level2name=N'FEntName'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'兴趣要求' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Table_Ent', @level2type=N'COLUMN',@level2name=N'FHobby_yaoqiu'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'年龄要求' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Table_Ent', @level2type=N'COLUMN',@level2name=N'FAge_yaoqiu'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'从事方向要求' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Table_Ent', @level2type=N'COLUMN',@level2name=N'FtypeID_yaoqiu'GOEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'类别要求' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Table_Ent', @level2type=N'COLUMN',@level2name=N'FclassID_yaoqiu'
--企业要求数据
1 北京牛X公司 音乐 23 null 10304