ホームページ >バックエンド開発 >PHPチュートリアル >Mysql テーブル作成ステートメント、mysql テーブル作成ステートメント_PHP チュートリアル
<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;