mysql中的set num的理解與介紹

2021-12-30 09:10:17 字數 1152 閱讀 2684

mysql中的enum和set其實都是string型別的而且只能在指定的集合裡取值,

不同的是set可以取多個值,enum只能取乙個

sql**

create table `20121101_t` (

`id` int(11) not null auto_increment,

`name` varchar(20) not null,

`cl` set('x','w','r') not null,

`c2` enum('f','d') not null,

primary key (`id`)

) engine=innodb

insert into 20121101_t

values(null,'a.txt','r,w','d');

insert into 20121101_t

values(null,'b.txt','r,w','f');比如給b.txt檔案加上執行許可權

sql**

update 20121101_t set cl = cl|1 where id =2

1是因為x許可權出現在了第乙個

再比如給b.txt檔案去掉寫許可權

sql**

update 20121101_t set cl = cl&~2 where id =2

這時再看

sql**

select * from 20121101_t

1 a.txt w,r d

2 b.txt x,r f

可以仿照linux下chmod的用法,直接用數字表示許可權

比如把b.txt變成唯讀

sql**

update 20121101_t set cl = 4 where id =2

比如要找到所有包含了讀許可權的檔案

sql**

select * from 20121101_t where cl&4

或者sql**

select * from 20121101_t where find_in_set('r',cl)>0

enum就相對簡單了,比如把a.txt從資料夾變成檔案

sql**

update 20121101_t set c2 = 'f' where id =1

pytorch中contiguous 的理解

功能 將tensor的記憶體變為連續的。有些tensor並不是占用一整塊記憶體,而是由不同的資料塊組成,而tensor的view 操作依賴於記憶體是整塊的,這時只需要執行contiguous 這個函式,把tensor變成在記憶體中連續分布的形式。注 在pytorch的最新版本0.4版本中,增加了to...

angular中transclude的理解

今天被這個transclude搞糊塗了,弄了半天,才知道原來使用起來很簡單。很煩惱為社麼書中的對於這個的介紹這麼晦澀難懂。直到看到了這篇文章,才讓我弄清楚了。一 transclude介紹 transclude是angular中自定義指令中的乙個引數。中文就是嵌入的意思。也就是說通過這個引數設定,可以...

對bibernate中inverse的理解

首先明確一點,inverse 控制反轉 屬性設定的意義只存在一對多,多對多這些含有集合的對應關係中 雙向關聯 就拿dept,emp例子來說吧!dept物件中有emp物件的引用 setemps emp物件中有dept物件的引用 也就是雙向關聯 按照資料建表的三大正規化,為了減少冗餘資料,emp表中必定...