Home > Backend Development > PHP Tutorial > A Mysql table creation statement

A Mysql table creation statement

WBOY
Release: 2016-08-08 09:33:00
Original
884 people have browsed it

<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;
Copy after login

The above introduces a Mysql table creation statement, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template