日期:2014-05-18  浏览次数:20769 次

人才招聘程序,做筛选,求达人给一个SQL语句思路。我可能把问题想复杂了,迷茫了
先大体描述一下:

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 ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE 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]

GO
SET ANSI_PADDING OFF
GO
EXEC 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'
GO
EXEC 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'
GO
EXEC 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'
GO
EXEC 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'
GO
EXEC 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'
GO
EXEC 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 ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE 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]

GO
SET ANSI_PADDING OFF
GO
EXEC 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'
GO
EXEC 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'
GO
EXEC 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'
GO
EXEC 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'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'类别要求' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'