Linux中的粘滞位及mysql日期函数

时间:2024-07-09 10:15:11

 只要用户具有目录的写权限, 用户就可以删除目录中的文件, 而不论这个用户是否有这个文件的写 权限.

为了解决这个不科学的问题, Linux引入了粘滞位的概念.

粘滞位

当一个目录被设置为"粘滞位"(用chmod +t),则该目录下的文件只能由

一、超级管理员删除

二、该目录的所有者删除

三、该文件的所有者删除

[root@centos /]# rz

将windows的内容上传到Linux

sz

将Linux内容上传到Windows

 在Linux中如何更改文件的所属组?

Linux修改文件所属用户及所属组(详细)_修改文件所属用户和所属组-****博客https://blog.****.net/qq_41602468/article/details/117932520

#当前日期
select curdate();
#now
select now();
#从现在往后70天
select date_add(now(),interval 70  day);

select NAME , datediff(curdate(),ENTRY_DATE) as 'entrydays' from tb_employee order by entrydays desc ;

#case when then else end
select
    NAME,
        (case WORK_ADDRESS when '北京' then '一线城市' when '上海' then '一线城市' else '二线城市' end) as '工作地址'
from tb_employee;

CREATE TABLE score(

	id int comment 'ID',

	name VARCHAR(20) comment '姓名',

	math int comment '数学',

	english int comment '英语',

	chinese int comment '语文'

) comment '学员成绩表';
insert into score (id, name, math, english, chinese) values (1,'Tom',67,88,95), (2,'Rose',23,66,90), (3,'Jack',56,98,76);

select
    id,
    name,
    (case when math >=85 then '优秀' when math >=60 then '及格' else '不及格' end) '数学',
    (case when math >=85 then '优秀' when math >=60 then '及格' else '不及格' end) '英语',
    (case when math >=85 then '优秀' when math >=60 then '及格' else '不及格' end) '语文'
from score;


create table user
(
    id int primary key auto_increment comment 'id',
    name varchar(10) not null unique comment '姓名',
    age int check ( age > 0 && age <= 120 ) comment '年龄',
    status char (1) default '1' comment '状态',#默认为1
    gender char(1) comment '性别'
) comment '用户表';
insert into user(name, age, status, gender) values ('tom1',19,'1','男'),
                                                    ('tom2',19,'1','男');