设计数据表用来存放视频文件信息有视频标题和视频的标签标签有n个n表示1~若干个要求能够通过标签来查询到视频标题查询视频标题时能够同时查到该视频的标签
表名:video_info
字段:
- id:视频唯一标识,自增长整数类型
- title:视频标题,字符串类型
- tags:视频标签列表,字符串类型,多个标签用逗号隔开
示例数据:
| id | title | tags | |----|----------------|---------------------------------------| | 1 | How to cook ramen | food, cooking, recipe | | 2 | Python tutorial | programming, Python, tutorial | | 3 | Yoga for beginners | fitness, yoga, health | | 4 | Travel vlog | travel, vlog, adventure | | 5 | DIY home decor | DIY, home decor, tutorial |
查询语句:
- 查询所有视频的标题和标签
SELECT title, tags FROM video_info;
- 根据标签查询视频标题和标签
SELECT title, tags FROM video_info WHERE tags LIKE '%标签名称%';
``
原文地址: https://www.cveoy.top/t/topic/fF9b 著作权归作者所有。请勿转载和采集!