某公司要根据雇员的职位来加薪,公司决定按下列加薪结构处理: DESIGNATION RAISE ----------------------- CLERK 500 SALESMAN 1000 ANALYST 1500 OTHERWISE 2000 编写一个程序块,接受一个雇员名,从emp表中实现上述加薪处理,写update语句 先判断姓名是否存在,如果存在,则基于姓名查询出职位,基于职位用if语句决定加薪的幅度,执行对应的update语句,记得commit
时间: 2023-02-26 11:54:09 浏览: 76
UPDATE emp SET salary = salary +
CASE designation
WHEN 'Clerk' THEN 500
WHEN 'Salesman' THEN 1000
WHEN 'Analyst' THEN 1500
ELSE 2000
END
WHERE name = 'emp_name';
相关问题
7-1 输出N件航材中价值最高航材的信息,编写C语言程序,输出N件航材中价值最高航材的信息。N用符号常量定义为5,航材信息包括件号(PN)、名称(Designation)、单价(Price)。注意:件号为长整型,名称是没有空格的字符串,最长不超过30个字符,单价为float类型。
下面是一个简单的实现,使用了方案一中的排序方法:
```c
#include <stdio.h>
#include <string.h>
#define N 5
typedef struct {
long pn; // 件号
char designation[31]; // 名称
float price; // 单价
} Aircraft;
// 按照价值降序排序
int cmp(const void *a, const void *b) {
Aircraft *p1 = (Aircraft *)a;
Aircraft *p2 = (Aircraft *)b;
return p2->price > p1->price ? 1 : -1;
}
int main() {
Aircraft aircrafts[N];
printf("请输入%d件航材的信息:\n", N);
for (int i = 0; i < N; i++) {
printf("请输入第%d件航材的信息:\n", i + 1);
printf("件号:");
scanf("%ld", &aircrafts[i].pn);
printf("名称:");
scanf("%s", aircrafts[i].designation);
printf("单价:");
scanf("%f", &aircrafts[i].price);
}
// 按照价值降序排序
qsort(aircrafts, N, sizeof(Aircraft), cmp);
printf("价值最高的航材信息如下:\n");
printf("件号\t名称\t单价\n");
printf("%ld\t%s\t%.2f\n", aircrafts[0].pn, aircrafts[0].designation, aircrafts[0].price);
return 0;
}
```
注意,上述代码中使用了`qsort`函数进行排序,需要包含`stdlib.h`头文件。此外,`scanf`函数读取字符串时需要使用`%s`格式,并且字符串数组的长度应该比最大输入长度大1(用于存储字符串末尾的空字符`\0`)。
README for navigating Sandia cell cycle data Zip file download designation Name scheme = chemistry_cell-number_temperature-range_Abuse oAll associated temperatures within the range specified are included in each folder o指定范围内的所有相关温度都包含在每个文件夹中 oWhere temperature-range is not specified, all temperatures are included o未指定温度范围,包括所有温度 Within the zip files the following naming convention applies to the data files themselves. 在zip文件中,以下命名约定适用于数据文件本身 Cycling_Data = cycling data at various temperatures 在各种温度下的循环数据 Name scheme = chemistry_cell-number_temperature_reg/mod Reg = regular discharge, i.e. not segmented 定期放电,即未分段 Mod = segmented discharge due to self-heating 由于自热时的分段放电 含义
这是关于Sandia电池循环数据Zip文件下载的README文件,其中包含了文件夹和文件的命名约定和含义:
- 文件夹命名规则:化学品_电池编号_温度范围_滥用情况
- 所有相关温度都包含在每个文件夹中,如果未指定温度范围,则包括所有温度
- 数据文件命名规则:化学品_电池编号_温度_放电类型
- 放电类型分为定期放电和自热分段放电
- Cycling_Data表示在各种温度下的循环数据