36 lines
1.4 KiB
Markdown
36 lines
1.4 KiB
Markdown
|
---
|
||
|
title: SQLの勉強
|
||
|
author: kazu634
|
||
|
date: 2008-05-31
|
||
|
url: /2008/05/31/_1011/
|
||
|
wordtwit_post_info:
|
||
|
- 'O:8:"stdClass":13:{s:6:"manual";b:0;s:11:"tweet_times";i:1;s:5:"delay";i:0;s:7:"enabled";i:1;s:10:"separation";s:2:"60";s:7:"version";s:3:"3.7";s:14:"tweet_template";b:0;s:6:"status";i:2;s:6:"result";a:0:{}s:13:"tweet_counter";i:2;s:13:"tweet_log_ids";a:1:{i:0;i:4057;}s:9:"hash_tags";a:0:{}s:8:"accounts";a:1:{i:0;s:7:"kazu634";}}'
|
||
|
categories:
|
||
|
- mysql
|
||
|
- SQL
|
||
|
|
||
|
---
|
||
|
<div class="section">
|
||
|
<p>
|
||
|
淡々と勉強の成果を書くよ。
|
||
|
</p>
|
||
|
|
||
|
<h4>
|
||
|
CREATE TABLE
|
||
|
</h4>
|
||
|
|
||
|
<p>
|
||
|
主キーと外部キーを持ったテーブルを作るよ。
|
||
|
</p>
|
||
|
|
||
|
<pre class="syntax-highlight">
|
||
|
<span class="synStatement">CREATE</span> <span class="synSpecial">TABLE</span> STORE_TABLE
|
||
|
(REQUEST_NO INT(<span class="synConstant">4</span>) <span class="synStatement">NOT</span> <span class="synSpecial">NULL</span>,
|
||
|
REQUEST_DATE <span class="synType">DATE</span> <span class="synStatement">NOT</span> <span class="synSpecial">NULL</span>,
|
||
|
ITEM_CODE <span class="synType">CHAR</span>(<span class="synConstant">5</span>) <span class="synStatement">NOT</span> <span class="synSpecial">NULL</span>,
|
||
|
NUM INT(<span class="synConstant">5</span>) <span class="synStatement">NOT</span> <span class="synSpecial">NULL</span>,
|
||
|
PRIMARY KEY(REQUEST_NO),
|
||
|
FOREIGN KEY(ITEM_CODE) REFERENCES *****
|
||
|
);
|
||
|
</pre>
|
||
|
</div>
|