查询员工的全名和工资,并且全名以大写的方式 显示,并且first_name的长度大于 6,最后工资降序排序?
时间: 2023-04-01 13:03:12 浏览: 72
SELECT UPPER(CONCAT(first_name, ' ', last_name)) AS full_name, salary
FROM employees
WHERE LENGTH(first_name) > 6
ORDER BY salary DESC;
相关问题
Java 中定义一个学生类Student,在类中定义4个成员变量id,age,last_name(姓),first_name(名),定义两个方法一个用于设置姓和名,另外一个方法getName返回该人的全名,
代码如下:
```
public class Student {
private int id;
private int age;
private String last_name;
private String first_name;
public void setName(String last_name, String first_name) {
this.last_name = last_name;
this.first_name = first_name;
}
public String getName() {
return this.last_name + " " + this.first_name;
}
}
```
在上述代码中,定义了一个Student类,其中包含了4个成员变量:id、age、last_name和first_name。其中,id和age是int类型,而last_name和first_name是String类型。
在该类中,定义了两个方法,一个用于设置姓和名,另外一个方法getName返回该人的全名。setName方法接受两个参数,即姓和名,将其分别赋值给last_name和first_name成员变量。getName方法返回该人的全名,使用字符串拼接的方式,将last_name和first_name连接起来返回。
这样,当我们需要创建一个学生对象时,可以通过调用setName方法来设置该学生的姓和名,然后通过调用getName方法来获取该学生的全名。
class Person: def __init__(self, last_name, first_name, gender, birthday): self.last_name = last_name self.first_name = first_name self.gender = gender self.birthd
ay = birthday
def get_full_name(self):
return self.first_name + " " + self.last_name
def get_age(self):
today = date.today()
age = today.year - self.birthday.year
if today.month < self.birthday.month or (today.month == self.birthday.month and today.day < self.birthday.day):
age -= 1
return age
这是一个用 Python 编写的人类类,它包括姓、名、性别和生日属性以及获取全名和年龄的方法。你可以通过创建 Person 类的实例来表示一个人,并使用 get_full_name() 方法获取其全名,使用 get_age() 方法获取其年龄。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![crx](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)