Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何SET在 MySQL 中使用数据类型?我有一个表Train,其中有字段
SET
Train
trainno int Weekdays set data type Stops set data type train name
如何编写一个选择查询,我可以将Stops集合与特定值进行比较,例如'Mumbai'?
Stops
'Mumbai'
创建一个类似的表:
CREATE TABLE cl_db.Train ( trainno INT PRIMARY KEY AUTO_INCREMENT, Stops set('aaa','bbb','ccc') NOT NULL )
你可以像这样查询它
select * from cl_db.Train where Stops like 'bbb'
或喜欢
select * from cl_db.Train where FIND_IN_SET('bbb',Stops)>0;