資料庫 查詢最晚入職員工的所有資訊

2021-09-11 19:56:37 字數 791 閱讀 4376

查詢最晚入職員工的所有資訊

create table `employees` (

`emp_no` int(11) not null,

`birth_date` date not null,

`first_name` varchar(14) not null,

`last_name` varchar(16) not null,

`gender` char(1) not null,

`hire_date` date not null,

primary key (`emp_no`));

emp_no

birth_date

first_name

last_name

gender

hire_date

10008

1958-02-19

saniya

kalloufi

m1994-09-15

示例1複製

複製

解決方法是,降序排序,只取第一行。

補充:用 desc 表示按倒序排序(即:從大到小排序)

用 acs表示按正序排序(即:從小到大排序)

具體**如下:

select emp_no,birth_date,first_name,last_name,gender,hire_date

from employees

order by hire_date desc limit 1;

資料庫SQL實踐 查詢最晚入職員工的所有資訊

題目描述 查詢最晚入職員工的所有資訊 create tableemployees emp noint 11 not null,birth datedate not null,first namevarchar 14 not null,last namevarchar 16 not null,gend...

01 查詢最晚入職員工的所有資訊 題解

有乙個員工employees表簡況如下 建表語句如下 create table employees emp no int 11 notnull birth date date notnull first name varchar 14 not null last name varchar 16 no...

sql演算法 查詢最晚入職員工的所有資訊

建表語句如下 create table employees emp no int 11 notnull birth date date notnull first name varchar 14 not null last name varchar 16 not null gender char 1...