首页 > 后端开发 > php教程 > 一则 Mysql 建表语句

一则 Mysql 建表语句

WBOY
发布: 2016-08-08 09:33:00
原创
869 人浏览过

<span> 1</span> <span>DROP</span> <span>TABLE</span> <span>IF</span> <span>EXISTS</span><span> `nuvue`;
</span><span> 2</span> 
<span> 3</span> <span>CREATE</span> <span>TABLE</span><span> `nuvue`(
</span><span> 4</span>     `id` <span>INT</span>(<span>10</span>) UNSIGNED <span>NOT</span> <span>NULL</span><span> AUTO_INCREMENT,
</span><span> 5</span>     `status` <span>TINYINT</span>(<span>2</span>) UNSIGNED <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>0</span> COMMENT <span>'</span><span>状态</span><span>'</span><span>,
</span><span> 6</span>     `uid` <span>INT</span>(<span>10</span>) UNSIGNED <span>NOT</span> <span>NULL</span> COMMENT <span>'</span><span>创建用户</span><span>'</span><span>,
</span><span> 7</span>     `province_id` <span>TINYINT</span>(<span>3</span>)  UNSIGNED <span>NOT</span> <span>NULL</span> COMMENT <span>'</span><span>一级城市</span><span>'</span><span>,
</span><span> 8</span>     `city_id` <span>TINYINT</span>(<span>3</span>)  UNSIGNED <span>NOT</span> <span>NULL</span> COMMENT <span>'</span><span>二级地区</span><span>'</span><span>,
</span><span> 9</span>     `name` <span>VARCHAR</span>(<span>100</span>) <span>NOT</span> <span>NULL</span> COMMENT <span>'</span><span>场地名称</span><span>'</span><span>,
</span><span>10</span>     `logo_url` <span>VARCHAR</span>(<span>100</span>) <span>NOT</span> <span>NULL</span> COMMENT <span>'</span><span>场地Logo</span><span>'</span><span>,
</span><span>11</span>     `location_address` <span>VARCHAR</span>(<span>200</span>) <span>NOT</span> <span>NULL</span> COMMENT <span>'</span><span>场地地址</span><span>'</span><span>,
</span><span>12</span>     `location_point` <span>VARCHAR</span>(<span>30</span>) <span>NOT</span> <span>NULL</span> COMMENT <span>'</span><span>场地坐标</span><span>'</span><span>,
</span><span>13</span>     `caoncat_phone` <span>VARCHAR</span>(<span>20</span>) <span>NOT</span> <span>NULL</span> COMMENT <span>'</span><span>联系人电话</span><span>'</span><span>,
</span><span>14</span>     `type` ENUM(<span>'</span><span>livehouse</span><span>'</span>,<span>'</span><span>theare</span><span>'</span>,<span>'</span><span>bar</span><span>'</span>,<span>'</span><span>bookshop</span><span>'</span>,<span>'</span><span>other</span><span>'</span>) <span>NOT</span> <span>NULL</span> COMMENT <span>'</span><span>场地类型</span><span>'</span><span>,
</span><span>15</span>     `phone` <span>VARCHAR</span>(<span>20</span>) <span>NOT</span> <span>NULL</span> COMMENT <span>'</span><span>场地电话</span><span>'</span><span>,
</span><span>16</span>     `area` <span>VARCHAR</span>(<span>10</span>) <span>NOT</span> <span>NULL</span> COMMENT <span>'</span><span>场地面积</span><span>'</span><span>,
</span><span>17</span>     `people` <span>VARCHAR</span>(<span>10</span>) <span>NOT</span> <span>NULL</span> COMMENT <span>'</span><span>容纳人数</span><span>'</span><span>,
</span><span>18</span>     `device` <span>VARCHAR</span>(<span>100</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span> COMMENT <span>'</span><span>场地设备</span><span>'</span><span>,
</span><span>19</span>     `introduction` <span>VARCHAR</span>(<span>100</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span> COMMENT <span>'</span><span>场地简介</span><span>'</span><span>,
</span><span>20</span>     `create_at` <span>DATETIME</span> <span>NOT</span> <span>NULL</span> COMMENT <span>'</span><span>创建时间</span><span>'</span><span>,
</span><span>21</span>     <span>PRIMARY</span> <span>KEY</span><span> `id`(`id`),
</span><span>22</span>     <span>UNIQUE</span> <span>KEY</span><span> `name`(`name`),
</span><span>23</span>     <span>KEY</span><span> `idx_type`(`type`),
</span><span>24</span>     <span>KEY</span><span> `idx_uid`(`uid`),
</span><span>25</span>     <span>KEY</span><span> `idx_status`(`status`),
</span><span>26</span>     <span>KEY</span><span> `idx_location`(`province_id`,`city_id`)
</span><span>27</span> )ENGINE<span>=</span> Myisam <span>DEFAULT</span> CHARSET <span>=</span> utf8;
登录后复制

以上就介绍了一则 Mysql 建表语句,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板