181.超过经理收入的员工

解析

select a.Name as Employee from Employee as a, Employee as b
where a.ManagerId = b.Id && a.Salary > b.Salary

把Employ看作2个表,a为员工表,b为经理表,且给员工也默认设置有ManagerId

通过select查询 Name 并且 as为 Employee

用where 判断  员工Id 和 对应经理Id 并且 工资还要大约经理

1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
employee.h: ```cpp #ifndef EMPLOYEE_H #define EMPLOYEE_H #include <string> using namespace std; class Employee { protected: int number; string name; int position; double monthBonus; double monthIncome; public: Employee(int number, string name, int position, double monthBonus); virtual ~Employee(); virtual void calculateMonthIncome() = 0; void showInfo(); }; #endif ``` employee.cpp: ```cpp #include "employee.h" #include <iostream> using namespace std; Employee::Employee(int number, string name, int position, double monthBonus) { this->number = number; this->name = name; this->position = position; this->monthBonus = monthBonus; this->monthIncome = 0; } Employee::~Employee() {} void Employee::showInfo() { cout << "编号:" << number << endl; cout << "姓名:" << name << endl; cout << "职务级别:" << position << endl; cout << "每月固定奖金:" << monthBonus << endl; cout << "每月月收入:" << monthIncome << endl; } ``` manager.h: ```cpp #ifndef MANAGER_H #define MANAGER_H #include "employee.h" class Manager : public Employee { public: Manager(int number, string name, int position, double monthBonus); ~Manager(); virtual void calculateMonthIncome(); }; #endif ``` manager.cpp: ```cpp #include "manager.h" Manager::Manager(int number, string name, int position, double monthBonus) : Employee(number, name, position, monthBonus) {} Manager::~Manager() {} void Manager::calculateMonthIncome() { monthIncome = 12000 * (3 - position + 1) / 3 + monthBonus + 3500; } ``` developer.h: ```cpp #ifndef DEVELOPER_H #define DEVELOPER_H #include "employee.h" class Developer : public Employee { private: int workHours; public: Developer(int number, string name, int position, double monthBonus, int workHours); ~Developer(); virtual void calculateMonthIncome(); }; #endif ``` developer.cpp: ```cpp #include "developer.h" Developer::Developer(int number, string name, int position, double monthBonus, int workHours) : Employee(number, name, position, monthBonus) { this->workHours = workHours; } Developer::~Developer() {} void Developer::calculateMonthIncome() { if (position == 1) { monthIncome = 6000 * (3 - position + 1) / 3 + monthBonus + workHours * 40 + 500; } else if (position == 2) { monthIncome = 6000 * (3 - position + 1) / 3 + monthBonus + workHours * 40; } else { monthIncome = 6000 * (3 - position + 1) / 3 + monthBonus; } } ``` main.cpp: ```cpp #include "employee.h" #include "manager.h" #include "developer.h" #include <iostream> using namespace std; int main() { Employee *e1 = new Manager(1001, "张三", 1, 5000); Employee *e2 = new Manager(1002, "李四", 2, 3000); Employee *e3 = new Developer(2001, "王五", 3, 2000, 80); Employee *e4 = new Developer(2002, "赵六", 1, 1000, 120); e1->calculateMonthIncome(); e2->calculateMonthIncome(); e3->calculateMonthIncome(); e4->calculateMonthIncome(); e1->showInfo(); e2->showInfo(); e3->showInfo(); e4->showInfo(); delete e1; delete e2; delete e3; delete e4; return 0; } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值