<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>さらでぃんのブログ</title>
<link>https://ameblo.jp/saraden0502/</link>
<atom:link href="https://rssblog.ameba.jp/saraden0502/rss20.xml" rel="self" type="application/rss+xml" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
<description>つーかーれーた</description>
<language>ja</language>
<item>
<title>プログラミング備忘録　＃41（異なるところで記事を書いたのでお休み</title>
<description>
<![CDATA[ <p>プログラミング備忘録　＃41（異なるところで記事を書いたのでお休み</p><p>&nbsp;</p><p>はい。題名の通りです。</p><p>&nbsp;</p><p>記事内容</p><p>・HTTP通信のステータスコード</p><p>・クラス図の読み方</p><p>・シーケンス図の読み方</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/saraden0502/entry-12412165684.html</link>
<pubDate>Mon, 15 Oct 2018 22:30:18 +0900</pubDate>
</item>
<item>
<title>プログラミング備忘録　＃40（JavaScript本格入門</title>
<description>
<![CDATA[ <p>プログラミング備忘録　＃40（JavaScript本格入門</p><p>&nbsp;</p><p>【値の集合を管理/操作】</p><p>・Arrayオブジェクト</p><p>　　配列型の値を扱うためのオブジェクト</p><p>　　var ary = ['佐藤','鈴木','田中']</p><p>&nbsp; &nbsp; &nbsp;var ary = new Array('佐藤','鈴木','田中');</p><p>&nbsp; &nbsp; &nbsp;var ary = new Array();</p><p>&nbsp;</p><p>　■スタック・キュー</p><p>　　　<a href="https://stat.ameba.jp/user_images/20181013/21/saraden0502/d5/09/g/o0369019114283581475.gif"><img alt="" height="191" src="https://stat.ameba.jp/user_images/20181013/21/saraden0502/d5/09/g/o0369019114283581475.gif" width="369"></a></p><p>　　　-スタック：push/popメソッド</p><p>　　　　例）var data = [];</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data.push(1);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data.push(2);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data.pop();</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data.pop()</p><p>&nbsp;</p><p>&nbsp; &nbsp; &nbsp; &nbsp;-キュー：push/shiftメソッド</p><p>　　　　例）var data=[];</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data.push(1);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data.push(2);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data.shift();</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data shift();</p><p>&nbsp;</p><p>&nbsp; ■配列に複数要素を追加/置換/削除するspliceメソッド</p><p>　　　var data =['Sato', 'Suzuki', 'Tanaka']</p><p>&nbsp; &nbsp; &nbsp; &nbsp;data.splice(1, 2, 'Yamada', 'Takahashi')</p><p>&nbsp; &nbsp; &nbsp; &nbsp;//結果：['Sato', 'Yamada', 'Takahashi']</p><p>&nbsp; &nbsp; &nbsp; &nbsp;data.splice(1, 2);</p><p>&nbsp; &nbsp; &nbsp; &nbsp;//結果：['Sato']</p><p>&nbsp; &nbsp; &nbsp; &nbsp;data.splice(1, 0,'Kato']]</p><p>&nbsp; &nbsp; &nbsp; &nbsp;//結果:['Sato', 'Kato', 'Tanaka']</p><p>&nbsp;</p><p>　■forEachメソッド</p><p>　　　配列内の要素を指定した関数で順に処理するためのメソッド</p><p>　　　例）var data = [2, 3, 4, 5]</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data.forEach(function(value, index, array){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//結果：2, 3, 4, 5</p><p>　　　　　※value：要素の値</p><p>　　　　　　 index：インデックス番号</p><p>　　　　　　 array：元の配列</p><p>&nbsp;</p><p>　■mapメソッド</p><p>　　　配列を指定された関数で加工</p><p>　　　例）var data = [2, 3, 4, 5]</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var result = data.map(function(valu, index, array){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return value;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//結果：[2, 3, 4, 5]</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;※戻り値として加工した値を返さないといけない</p><p>&nbsp;</p><p>　■someメソッド</p><p>　　　指定された関数で個々の要素を判定し、1つでも条件に合致する要素があればtrueを返す</p><p>　　　例）var data = [4, 9, 16, 25]</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var result = data.some(function(value, index, array){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return value % 3 === 0;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//結果：true</p><p>&nbsp;</p><p>　■filterメソッド</p><p>　　　指定された関数での個々の要素を判定し、条件に合致した要素だけを取り出す</p><p>　　　例）var data = [4, 9, 16, 25]</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var result = data.filter(fu;nction(valu, index, array){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return value % 2 === 1;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;});</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //結果：[9, 25]</p><p>&nbsp;</p><p>&nbsp; ■sortメソッド</p><p>　　　独自のルールで配列を並び替える</p><p>　　　例）var ary = [6, 25, 10]</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ary.sort(); //結果：[10, 25, 5]（文字列としてソート）</p><p>&nbsp;</p><p>・Mapオブジェクト</p><p>　　連想配列を操作</p><p>　　　例）let m = new Map();</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m.set('dog', 'わんわん');</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //key dog value わんわん</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m.set('cat', 'にゃー');</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m.size //2</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m.get('dog') //わんわん</p><p>　　　　　 m.has('cat') //true</p><p>　　　　　 m.clear() //0</p><p>&nbsp; &nbsp; &nbsp;■オブジェクトリテラルとの違い</p><p>　　　1.任意の型でキー設定</p><p>　　　　　⇒オブジェクトやNaNなどですらキーになる</p><p>　　　2.マップのサイズを取得</p><p>　　　3.クリーンなマップを作成できる</p><p>　　　　　⇒空の連想配列を生成できる</p><p>&nbsp;</p><p>　　■注意点</p><p>　　　1.キーは「＝＝＝」演算子で比較</p><p>　　　2.特別なNaNは特別ではない</p><p>　　　　　-本来NaN !== NaN</p><p>　　　　　-Mapの時　NaN === NaNとして扱われる</p><p>　</p><p>・Setオブジェクト</p><p>　重複しない値の集合を操作</p><p>　　例）let s = new Set();</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s.add(1);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s.add(2);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s.add(3);</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; s.add(1); //同じ値は無視される</p><p>　　　　 s.size //4</p><p>　　　　※オブジェクトの際は、異なるオブジェクトとして扱われる</p><p>&nbsp;</p><p>・Dateオブジェクト</p><p>　　-日付/時刻データを操作</p><p>　　　参考：<a href="https://www.scollabo.com/banban/java/ref_15.html">https://www.scollabo.com/banban/java/ref_15.html</a></p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/saraden0502/entry-12411721649.html</link>
<pubDate>Sat, 13 Oct 2018 23:51:05 +0900</pubDate>
</item>
<item>
<title>プログラミング備忘録　＃39（JavaScript本格入門</title>
<description>
<![CDATA[ <p>プログラミング備忘録　＃39（JavaScript本格入門</p><p>&nbsp;</p><p>【制御構文】</p><p>　・順次：記述された順番に処理を行う</p><p>　・選択：条件によって処理を分岐</p><p>　・反復：特定の処理を繰り返し実行</p><p>&nbsp;</p><p>【switch】</p><p>※switch式とcase値は「＝＝＝」演算子で比較する</p><p>例）var x= '0';</p><p>&nbsp; &nbsp; &nbsp;switch(x){</p><p>&nbsp; &nbsp; &nbsp; &nbsp; case 0:</p><p>&nbsp; &nbsp; &nbsp; &nbsp; //ここは実行されない</p><p>&nbsp; &nbsp; }</p><p>&nbsp;</p><p>【カンマ演算子】</p><p>for(var i=1 ,j=1;&nbsp; i&lt;5; i++, j++){</p><p>&nbsp; &nbsp;console.log('i * jは'+i *j);</p><p>}</p><p>結果）</p><p>i * jは1</p><p>i * jは4</p><p>i * jは9</p><p>i * jは16</p><p>&nbsp;</p><p>【for in命令】</p><p>※for in命令では処理の順序も保証されない</p><p>　⇒配列の拡張（prototype）を行った際、拡張されたものも呼び出す</p><p>そのため、for of演算子を使用する</p><p>&nbsp;</p><p>【for of命令】</p><p>使い方はfor in命令と同じ</p><p>⇒配列の拡張を行った際、拡張されたものは呼び出さない</p><p>&nbsp;</p><p>【文字列の出力】</p><p>document.write：ページに指定された文字列を出力する命令</p><p>⇒ドキュメントをすべて出力した後に呼び出した場合、ページがクリアされる</p><p>そのため、textContentやinnerHTMLが使用されることが多い</p><p>&nbsp;</p><p>【例外処理】</p><p>・例外処理はオーバーヘッドが大きいため、try..catchをループの外に入れれるか検討する</p><p>※オーバヘッド：本来の処理を行うための付加処理</p><p>&nbsp;</p><p>・エラーの種類</p><p>　■EvalError：不正なeval関数</p><p>　※eval関数：引数に指定した文字列をJavaScriptプログラムコードとして評価・実行する機能をもつ関数</p><p>　■RangeError：指定された値が許容範囲を超えている</p><p>　■ReferenceError：宣言されていない変数にアクセス</p><p>　■SyntaxError：文法エラー</p><p>　■TypeError：指定された値が期待されたデータ型でない</p><p>　■URｌError：不正なURｌ</p><p>&nbsp;</p><p>【オブジェクト】</p><p>　JavaScriptはオブジェクト指向</p><p>　オブジェクト=プロパティ+メソッド</p><p>　⇒データを操作するための様々な機能を持った入れ物</p><p>&nbsp;</p><p>　・オブジェクトの作り方（new演算子）</p><p>　　オブジェクトの複製を作ることをインスタンス化</p><p>　　var 変数名 = new オブジェクト名([ 引数 ]);</p><p>&nbsp;</p><p>【静的プロパティ/静的メソッド】</p><p>　例外的にインスタンスを生成せずに利用できるもの</p><p>&nbsp;</p><p>【基本データを扱うためのオブジェクト】</p><p>　・Stringオブジェクト</p><p>　　indexOf,charAt,replaceなど</p><p>　　詳細：<a href="https://qiita.com/may88seiji/items/4044aa86594de1938b46">https://qiita.com/may88seiji/items/4044aa86594de1938b46</a></p><p>&nbsp;</p><p>　・Numberオブジェクト</p><p>　　NaN,parseIntなど</p><p>　　詳細：<a href="https://www.scollabo.com/banban/java/ref_20.html">https://www.scollabo.com/banban/java/ref_20.html</a></p><p>&nbsp;</p><p>&nbsp;</p><p>　　</p><p>　</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/saraden0502/entry-12411249236.html</link>
<pubDate>Thu, 11 Oct 2018 21:59:47 +0900</pubDate>
</item>
<item>
<title>プログラミング備忘録　＃38（JavaScript本格入門</title>
<description>
<![CDATA[ <p>プログラミング備忘録　＃37（JavaScript本格入門</p><p>&nbsp;</p><p>昨日、寝落ちしたため本日更新</p><p>(´・ω・｀)</p><p>&nbsp;</p><p>【データ型】</p><p>・基本型：値そのものが直接格納</p><p>・参照型：値を実際に格納しているメモリ上のアドレスを格納</p><p>&nbsp;</p><p>【リテラル】</p><p>・リテラルとは</p><p>　データ型に格納できるそのもの</p><p>　■数値リテラル</p><p>　　-10進数リテラル：100、3、0</p><p>　　-16進数リテラル：0xFFffFF、0xCC55CC</p><p>　　-8進数リテラル：0o600、0o644</p><p>　　-2進数リテラル：0b01、0b101</p><p>　</p><p>　■文字列リテラル</p><p>　　"JavaScript"、'JavaScript' ⇒ 両方OK</p><p>　　-テンプレート文字列</p><p>　　　文字列への変数への埋め込み</p><p>　　　例）let name="鈴木";</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;let str ="こんにちは、${name}さん。"</p><p>　　　　　⇒こんにちは、鈴木さん</p><p>&nbsp;</p><p>　■配列リテラル</p><p>　　　データの集合のリテラル</p><p>　　　例）let data = ['JavaScript','Ajax','ASP.NET']</p><p>　　　　　1つ目のデータの取り出し</p><p>　　　　　⇒data[0]</p><p>&nbsp;</p><p>　■オブジェクトリテラル</p><p>　　　オブジェクト：名前をキーにアクセスできる配列</p><p>　　　{キー名：値,キー名：値,キー名：値}</p><p>　　　例）var obj = {x:1,y:2,z:3}</p><p>　　　　　obj.x ⇒ 1</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;obj['x'] ⇒ 1　　</p><p>&nbsp;</p><p>　■未定義値（undefined）</p><p>　　　定義されていない値</p><p>　　　・ある変数が宣言済みであるものの値を与えられていない</p><p>　　　・未定義のプロパティを参照しようとした</p><p>　　　・関数で値が返されなかった</p><p>&nbsp;</p><p>【演算子】</p><p>　■算術演算子</p><p>　　+、-、*、/、％</p><p>　　前置演算子：x = 3; a = ++x ⇒aは4</p><p>　　後置演算子：ｘ = 3; a = x++ ⇒aは3</p><p>&nbsp;</p><p>　■小数点を含む計算</p><p>　　　2進数に直して計算しているため、誤差が出る</p><p>　　　例）0.2 * 3 ⇒ 0.60000000001</p><p>&nbsp; &nbsp; &nbsp; &nbsp;※if(0.2 * 3 ===0.6) ⇒ false</p><p>　　　　　改善案）一度整数に直して計算を行う</p><p>&nbsp;</p><p>　■基本型と参照型による代入の違い</p><p>　　　基本型と参照型で代入した値が異なる</p><p>　　　例）[基本型]</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var x = 1;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var y =x;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;x =&nbsp; 2;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;console.log(y) ⇒ 1</p><p>&nbsp;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[参照型]</p><p>　　　　　var data1 = [0, 1, 2];</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var data2 = data1;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;data1[0] = 5;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;console.log(data2) ⇒[5, 1, 2]</p><p>&nbsp;</p><p>　■定数の扱い</p><p>　　　定数は再代入できない</p><p>　　　例）const TAX = 1.08;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TAX = 1.1　⇒　エラー</p><p>&nbsp;</p><p>　■delete演算子</p><p>　　オペランドに指定した変数や配列要素、オブジェクトのプロパティを破棄</p><p>　　例）var ary = ['JavaScript','Ajax','ASP.NET'];</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;console.log(delete ary[0]);　結果true</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;console.log(ary);　　　　　　　結果[1:'Ajax',2:'ASP.NET']</p><p>　　　　⇒配列の要素が削除されるが、要素は繰り上がらない</p><p>&nbsp;</p><p>　　　　ほかにも・・・</p><p>　　　　・プロパティを削除した際、プロパティのみが削除される</p><p>　　　　・明示的に宣言された変数を削除することができない</p><p>&nbsp;</p><p>　■typeof演算子</p><p>　　　・オペランドに指定した変数/リテラルのデータ型を文字列を返す</p><p>　　　例）var num = 1;</p><p>　　　　　console.log(typeof num); //number</p><p>&nbsp;&nbsp;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var str = "こんにちは";</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;console.log(typeof str); //string</p><p>&nbsp;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var flag&nbsp;= true;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;console.log(typeof flag);//boolean</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/saraden0502/entry-12411238492.html</link>
<pubDate>Thu, 11 Oct 2018 21:17:53 +0900</pubDate>
</item>
<item>
<title>プログラミング備忘録　＃36（JavaScript本格入門</title>
<description>
<![CDATA[ <p>プログラミング備忘録　＃36（JavaScript本格入門</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#ff0000;">【JavaScriptとは】</span></span></p><p>ブラウザ向けスクリプト言語</p><p>※スクリプト言語：簡易的なプログラミング言語</p><p>　　参考）<a href="https://kotobank.jp/word/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E8%A8%80%E8%AA%9E-4873#E3.83.87.E3.82.B8.E3.82.BF.E3.83.AB.E5.A4.A7.E8.BE.9E.E6.B3.89">https://kotobank.jp/word/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88%E8%A8%80%E8%AA%9E-4873#E3.83.87.E3.82.B8.E3.82.BF.E3.83.AB.E5.A4.A7.E8.BE.9E.E6.B3.89</a></p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#ff0000;">【JavaScriptの特徴】</span></span></p><p>①スクリプト言語</p><p>②インタプリター型の言語</p><p>　　※インタプリター言語：プログラムを先頭から逐一解析し、　&nbsp; &nbsp;　　　　コンピュータに理解できる形式に翻訳しながら実行していく言語</p><p>③様々な環境で利用できる</p><p>&nbsp;</p><p><span style="color:#ff0000;"><span style="font-weight:bold;">【開発者ツールの起動方法】</span></span></p><p>①GoogleChrome：[設定] &gt; [その他のツール] &gt; [デベロッパーツール]</p><p>②MicrosoftEdge：[詳細] &gt; [F12開発者ツール]</p><p>③InternetExplorer：[ツール] &gt; [F12開発者ツール]</p><p>④Firefox：[メニュー] &gt; [開発者ツール] &gt; [開発者ツールを表示]</p><p>⑤Opera：[メニュー] &gt; [開発者] &gt; [開発者用ツール]</p><p>⑥Safari：[開発] &gt; [Webインスペクタを表示]</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#ff0000;">【開発者ツールのメニュー】</span></span></p><p>①Elements：HTML/CSSの状態を確認</p><p>　　-「矢印マーク」：選択したものと対応するソースが選択状態になる</p><p>　　-「Styles」：その要素に適用されたファイルが確認できる</p><p>&nbsp;</p><p>②Network：ブラウザ上で発生した通信を確認できる</p><p>　　-Timeline：ダウンロードにかかった時間を表示</p><p>　　-個々の項目をダブルクリックで詳細を確認</p><p>　　　⇒非同期処理ではHeaders、Responseなどを確認</p><p>&nbsp;</p><p>③Sources：スクリプトのデバッグ</p><p>　　-コードの行番号をクリックすることでブレイクポイントを設置</p><p>　　-Watchの＋をクリックすることで変数の状態を確認</p><p>&nbsp;</p><p>④Application：ストレージ/クッキーの内容を確認</p><p>　　-現在のページを構成するファイルを確認できる</p><p>&nbsp;</p><p>⑤Console：ログ確認/オブジェクト操作</p><p>　　-エラーメッセージやログの確認</p><p>　　　×ボタンをクリックすることでエラーを確認できる</p><p>　　-対話的にコードを実行できる</p><p>　　　コンソール上でJavaScriptのコードを実行できる</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#ff0000;">【JavaScriptの基本的な文法】</span></span></p><p>①JavaScriptで「こんにちは、世界！」と表示</p><p>　//html,headタグは省略</p><p>　&lt;body&gt;</p><p>　&lt;script type="text/javascript"&gt;</p><p>　windows.alert('こんにちは、世界！');</p><p>　&lt;/script&gt;</p><p>　&lt;noscript&gt;Javascriptが利用できません&lt;/nonscript&gt;</p><p>　&lt;/body&gt;</p><p>　※実行時、エラーが発生したとき</p><p>　　開発者ツールのConsoleで確認</p><p>　　例）「～.html：10」　⇒ 10行目でエラーが発生している</p><p>&nbsp;</p><p>②JavaScriptをHTMLファイルに組み込む&lt;script&gt;要素</p><p>　　&lt;script type="text/javascript"&gt;</p><p>&nbsp; &nbsp; &nbsp;javascriptのコード</p><p>　　&lt;/script&gt;</p><p>　※&lt;script&gt;要素を記述する場所</p><p>　　　1）△：&lt;body&gt;要素の配下</p><p>　　　2）◎：&lt;body&gt;要素の配下（&lt;/body&gt;閉じタグの直前）</p><p>　　　3）〇：&lt;head&gt;要素の配下</p><p>&nbsp;</p><p>　　■外部スクリプトをインポート</p><p>　　　メリット）・コードの再利用が可能</p><p>　　　　　　　　・htmlファイルの見通しが良くなる</p><p>　　　&lt;script type="text/javascript" src="path" [charset="encoding"]&gt;</p><p>&nbsp; &nbsp; &nbsp; &nbsp;※path：スクリプトファイルへのパス</p><p>　　　　&nbsp; encoding：スクリプトファイルで利用している文字コード</p><p>&nbsp;</p><p>　　 ■JavaScript無効環境の代替コンテンツの表示</p><p>　　　　&lt;noscript&gt; ～ &lt;/noscript&gt;</p><p>&nbsp;</p><p>&nbsp; &nbsp; &nbsp; ■JavaScript疑似プロトコル</p><p>　　　　&lt;a href="JavaScript:スクリプトコード"&gt;リンクテキスト&lt;/a&gt;</p><p>&nbsp; &nbsp; &nbsp;　　例）</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;a href="JavaScript:window.alert('こんにちは');"&gt;ダイアログを表示&lt;/a&gt;</p><p>　　　　⇒「ダイアログを表示」をクリックすると、「こんにちは」と表示</p><p>&nbsp;</p><p>③文のルール</p><p>　　1）文の末尾にセミコロンを付ける</p><p>　　2）文の途中で空白や改行/タブを含めることが可能</p><p>　　　例）window.&nbsp; &nbsp; &nbsp;alert&nbsp; (`こんにちは');</p><p>　&nbsp; 3）大文字・小文字が区別される</p><p>&nbsp;</p><p>④コメントの挿入</p><p>　　①単一行コメント：//コメント</p><p>　　②複数行コメント：/*　コメント　*/</p><p>　　③ドキュメンテーションコメント：/**　コメント　*/</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#ff0000;">【変数/定数】</span></span></p><p>①変数宣言</p><p>　　■var 変数名[= 初期値], ...</p><p>&nbsp; &nbsp; 　 例）var msg;</p><p>&nbsp;</p><p>&nbsp; &nbsp; ■let宣言</p><p>　　　例）let msg;</p><p>&nbsp; &nbsp; &nbsp; &nbsp;メリット）1.変数の重複を許可しない</p><p>　　　　　　　　　 ⇒同じ変数名を使用できない</p><p>　　　　　　　&nbsp; &nbsp;2ブロックスコープを認識</p><p>&nbsp;</p><p>②識別子の命名規則</p><p>　1）1文字目は英字/アンダースコアー/ドル記号（＄）</p><p>　　例）_name,$msg</p><p>&nbsp; 2)2文字目以降は、1文字目で使える文字、もしくは数字</p><p>　　例）msg1,_name0</p><p>&nbsp; 3)変数名の大文字、小文字は区別される</p><p>　4）JavaScriptで意味を持つ予約語でない</p><p>&nbsp;</p><p>　・変数/関数名　⇒ camelCase記法</p><p>　・定数名　⇒　アンダースコア記法</p><p>　・クラス（コンストラクタ）名　⇒　Pascal記法</p><p>&nbsp;</p><p>③変数を定数に書き換え</p><p>　 const 変数名 = 値;</p><p>&nbsp; &nbsp;例）const TAX = 1.08;</p><p>&nbsp; &nbsp;※定数はすべて大文字で記載</p><p>　　　例）TAX_PRICE</p>
]]>
</description>
<link>https://ameblo.jp/saraden0502/entry-12410800322.html</link>
<pubDate>Tue, 09 Oct 2018 22:46:00 +0900</pubDate>
</item>
<item>
<title>プログラミング備忘録　＃35（MySQL</title>
<description>
<![CDATA[ <p>プログラミング備忘録　＃35（MySQL</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//外部キー制約</span></span></p><p>①制約の設定</p><p>　　alter table テーブル名 add constraint 制約名 foreign key（外部キー） references 外部テーブル（外部テーブルのキー）</p><p>　　例）alter table comments add constraint fk_comments foreign key(post_id) references posts(id);</p><p>　　※posts(id)とkey(post_id）の型が一致している必要がある</p><p>　　※deleteする際、他のところで関連するものがあれば、エラーが出る</p><p>　　⇒外部キーなら消去することができる</p><p>&nbsp;</p><p>②制約の解除</p><p>　　alter table テーブル名 drop foreign key キー名;</p><p>&nbsp; &nbsp; 例）alter table comments drop foreign key fk_comments;</p><p>&nbsp;</p><p>//直前に挿入されたレコードのidを調べる方法</p><p>　last_insert_id()</p><p>&nbsp; 例）insert into comments(post_id, body) values(last_insert_id(), 'first comment for new post');</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//トリガー</span></span></p><p>　①トリガー作成方法(after：処理後, before：処理前)</p><p>　　create trigger トリガー名 after 処理名 on テーブル名 対象にするカラム 処理名 values　値</p><p>　　例）create trigger posts_insert_trigger after&nbsp;insert on posts for each row insert into logs(msg) values('post added!');</p><p>&nbsp; &nbsp; ※1）after insert on posts for each row：</p><p>　　　　　insert処理が終わった後postsテーブルのそれぞれの行に対して</p><p>　　※2）insert into logs(msg) values('post added!')：</p><p>　　　　　logsテーブルのmsgにpost added!と挿入　　</p><p>&nbsp;</p><p>　②トリガーの削除方法</p><p>　　drop trigger if exists トリガー名;</p><p>&nbsp;</p><p>　③トリガーの確認方法</p><p>　　show triggers;</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//挿入、更新時刻でレコードを更新</span></span></p><p>　①create時に時刻のカラムを作成し、挿入時間を値として代入</p><p>　　 created datetime default カラム名;</p><p>&nbsp; &nbsp; &nbsp; 例）create datetime default current_timestamp:</p><p>&nbsp;</p><p>&nbsp; ②update時に時刻のカラムを作成し、挿入時間を値として代入</p><p>　　updated datetime default 更新したいカラム名 on update カラム名；</p><p>　　例）updated datetime default current_timestamp on update current_timestamp;</p><p>&nbsp; &nbsp; &nbsp;※updateを行うと、現在の時刻がcurrent_timestampに代入される</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//日時の計算</span></span></p><p>　①日時の表示</p><p>　　update テーブル名　set created = '日時';</p><p>&nbsp; &nbsp; &nbsp;例）update posts set created = '2018-10-08 10:00:00' where id= 2;</p><p>&nbsp;</p><p>&nbsp; ②日時での条件指定</p><p>　　select * from テーブル名 where 条件</p><p>　　例）select * from posts where created &gt; '2018-10-08 10:00:00';</p><p>&nbsp;</p><p>&nbsp; ③日時を進める</p><p>　　select * from date_add(進めたいカラム, interval 進めたい日付) from テーブル名;</p><p>&nbsp; &nbsp; 例）select * from date_add(created, interval 14 day) from posts;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; ※2weekでも可能</p><p>&nbsp;</p><p>　④書式の変更</p><p>　　select date_format(変更したいカラム, 表記方法) from テーブル名</p><p>　　例）select date_format(created, '%W %M %Y') from posts;</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//データベースの書き出し</span></span></p><p>　mysqldump -u ユーザー名 -p データベース名 &gt; ファイル名</p><p>　例）mysqldump -u myapp_user -p myapp &gt; 201810.backup.sql;</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//データの読み込み</span></span></p><p>　\. ./ファイル名</p><p>　例）\. ./201810.backup.sql;　</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/saraden0502/entry-12410563407.html</link>
<pubDate>Mon, 08 Oct 2018 22:28:10 +0900</pubDate>
</item>
<item>
<title>プログラミング備忘録　＃34(MySQL</title>
<description>
<![CDATA[ <p>プログラミング備忘録　＃34(MySQL</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//抽出条件に名前を付けてテーブルのように扱う（view）</span></span></p><p>create view ビュー名 as select 取り出したい条件</p><p>例）create view top3 as select * from users order by score desc limit 3;</p><p>※同じviewを作るとエラーになる</p><p>　</p><p><span style="font-weight:bold;"><span style="color:#009944;">//viewの削除</span></span></p><p>drop view if exist 削除したいビュー</p><p>例）drop view if exists top3;</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//viewの確認</span></span></p><p>show tables;</p><p>※テーブルと同じ扱いになっている</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//トラザクション</span></span></p><p>トラザクション：一連の処理をまとめて行うもの</p><p>⇒途中でエラーが出ている場合、処理の途中で終わってしまうため</p><p>start transaction; (処理） commit;</p><p>例）start transaction;</p><p>&nbsp; &nbsp; &nbsp;update users set score = score -1.2 where name = 'sample0';</p><p>&nbsp; &nbsp; &nbsp;update users set score = score +1.2 where name = 'sample1';</p><p>&nbsp; &nbsp; &nbsp;commit;</p><p>&nbsp; &nbsp; &nbsp;※途中でエラーを吐いた場合、更新内容を無効にする</p><p>　　　⇒rollback;</p><p>例）start transaction;</p><p>&nbsp; &nbsp; &nbsp;update users set score = score -1.2 where name = 'sample0';</p><p>&nbsp; &nbsp; &nbsp;update users set score = score +1.2 where name = 'sample1';</p><p>&nbsp; &nbsp; &nbsp;rollback;</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//索引</span></span></p><p>　　①索引の設定</p><p>　　　&nbsp;alter table テーブル名 add index 索引の名前(索引を設定したいカラム）</p><p>　　　 例）alter table users add index index_score(score);</p><p>&nbsp;</p><p>　&nbsp; ②索引が使われているかの確認</p><p>　　　　explain select * from テーブル名 where 条件;</p><p>&nbsp; &nbsp; &nbsp; &nbsp;例）explain select * from users where score &gt; 5.0;</p><p>&nbsp;</p><p>&nbsp; &nbsp; ③索引の削除</p><p>　　　alter table テーブル名 drop index 索引名;</p><p>&nbsp;</p><p>&nbsp; &nbsp; ④現在の索引の状況の確認</p><p>　　　show index from テーブル名;</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//複数のテーブル</span></span></p><p>&nbsp; ①複数のテーブルの作成方法</p><p>　create table テーブル名(</p><p>&nbsp; &nbsp; &nbsp;カラム名 型</p><p>&nbsp; &nbsp; &nbsp;);</p><p>&nbsp; create table テーブル名(</p><p>&nbsp; &nbsp; &nbsp;カラム名 型</p><p>&nbsp; &nbsp; );</p><p>&nbsp;</p><p>&nbsp; ②内部結合でデータの抽出</p><p>　　-inner join：2つのテーブルに共通のデータだけを取得</p><p>　　select * from テーブル名 inner join 結合したいテーブル名 on 抽出するデータ</p><p>　例）select * from posts inner join comments on posts.id = comments.post_id;</p><p>　⇒一つのテーブルしかないものはテーブルの要素として作られない</p><p>&nbsp;</p><p>　③外部結合でデータの抽出</p><p>　　　-outer join：2つのテーブルで一致しないデータも含めてデータを取得</p><p>　　③-1.select * from テーブル名 left outer join 結合したいテーブル名 on 抽出するデータ</p><p>　　例）select * from posts left outer&nbsp;comments on posts.id = comments.post_id;</p><p>　　③-2.select * from テーブル名 left outer join 結合したいテーブル名 on 抽出するデータ</p><p>&nbsp; &nbsp; 例）select * from posts right&nbsp;outer&nbsp;comments on posts.id = comments.post_id;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/saraden0502/entry-12410511538.html</link>
<pubDate>Mon, 08 Oct 2018 19:04:37 +0900</pubDate>
</item>
<item>
<title>プログラミング備忘録　＃33(MySQL</title>
<description>
<![CDATA[ <p>プログラミング備忘録　＃33(MySQL</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//文字列の演算</span></span></p><p>　①文字列の長さ</p><p>　　select length(数えたい文字列);</p><p>&nbsp; &nbsp; &nbsp;例）select length("hello"); ⇒ 5</p><p>&nbsp;&nbsp;</p><p>&nbsp; ②文字列の一部の取り出し</p><p>　&nbsp; select substr('hello', 2); ⇒ ello</p><p>&nbsp; &nbsp; select substr('hello', 2 , 3) ⇒ ell</p><p>&nbsp;</p><p>&nbsp; ③文字列を大文字・小文字に</p><p>　　select upper('hello'); ⇒ HELLO</p><p>&nbsp; 　select lower('HELLO'); ⇒ hello</p><p>&nbsp;</p><p>　④文字列の連結</p><p>　　select concat('hello' , 'world'); ⇒ helloworld</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//名前の文字数で並び替え</span></span></p><p>　select length(name) , name from users order by length(name);</p><p>&nbsp; ※length(name) ⇒ nameの長さ</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//別名を付ける方法</span></span></p><p>　別名を付けたいもの as 別名</p><p>　例）select length(name) as len, name from users order by len;</p><p>　※length(name)　= len</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//特定のデータのみ代入できるもの（enum）</span></span></p><p>　rank enum('red','blue','yellow') ⇒ red,blue,yellowのみ代入できる</p><p>　例）create table test(</p><p>&nbsp; &nbsp; &nbsp; &nbsp;rank enum('red','blue','yellow')</p><p>&nbsp; &nbsp; &nbsp; );</p><p>&nbsp; &nbsp; &nbsp; insert into users(rank) values('red');</p><p>&nbsp; &nbsp; &nbsp; ※特定のデータ以外の場合は表示されない</p><p>　　&nbsp; ※'red' = 1, 'blue' = 2 , 'yellow' = 3として扱われている</p><p>　　　⇒select&nbsp;&nbsp;* from test where rank = 2でもOK</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//複数の選択肢から複数選べるもの(set)</span></span></p><p>&nbsp; test set('red', 'blue' , 'yellow')</p><p>&nbsp; 例）create table test(</p><p>&nbsp; &nbsp; &nbsp; &nbsp;test set('red', 'blue' , 'yellow')</p><p>&nbsp; &nbsp; &nbsp; );</p><p>&nbsp; &nbsp; &nbsp; insert into users(test) values('red','blue');</p><p>　</p><p>&nbsp; &nbsp; データ検索時</p><p>　　　select * from テーブル名 where カラム名 = 'データ1, データ2';</p><p>　　　※'red' = 1, 'blue' = 2, 'yellow' = 3として扱われている</p><p>　　　⇒select * from テーブル名 where カラム名 = 2;</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//条件分岐</span></span></p><p>　①if</p><p>　if(条件）</p><p>　例）select if(score &gt; 5.0,'OK','NG') as result from テーブル名</p><p>　⇒OK または NGのみ表示</p><p>　※全て表示したい場合</p><p>　⇒select *, if(score &gt; 5.0,'OK','NG') as result from テーブル名</p><p>&nbsp;</p><p>&nbsp; ②case</p><p>　case（条件）</p><p>　例）select case floor(score) %2 when 0 then 'even' when 1 then 'odd' else null</p><p>&nbsp; ※score &gt; 1.0のような書き方もできる</p><p>　⇒select case floor(score) %2 when score &gt;1.0 then 'team-A' else 'team=B'</p><p>&nbsp;</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//抽出結果のテーブルを作成する方法</span></span></p><p>　create table テーブル名 as select テーブルのカラム case when 条件 then　出力値 from テーブル名</p><p>　例）create table users_with_team as select id,name,score, case when score &gt; 8.0 then 'TeamA' else 'TeamB' end as team&nbsp;from users;</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//テーブルのコピー</span></span></p><p>　create table 新しく作成するテーブル名 select * from コピーしたいテーブル名;</p><p>　例）create table user_copy select * from users;</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//同じ構造で空のテーブルをコピー</span></span></p><p>　create table 新しく作成するテーブル名 like コピーしたいテーブル名</p><p>&nbsp; 例）create table user_empty like users;</p><p>&nbsp;</p><p><span style="color:#009944;"><span style="font-weight:bold;">//データの集計処理</span></span></p><p>　①データの個数を調べる</p><p>　　select count(*) from テーブル名</p><p>　　例）select count() from users;</p><p>　　※nuｌｌを排除する方法</p><p>　　　　select count(nullを排除して数える場所） from テーブル名;</p><p>&nbsp; 　　　例）select count(crore) from users;</p><p>&nbsp;</p><p>&nbsp;②合計値など</p><p>　　②-1.合計：sum(合計したいカラム）</p><p>　　　　　例）select sum(score) from users;</p><p>&nbsp;</p><p>　　②-2.最小：min（最小を調べたいカラム）</p><p>　　　　　例）select min(score) from users;</p><p>&nbsp;</p><p>　　②-3.最大：max（最大を調べたいカラム）</p><p>　　　　　例）select max(score) from users;</p><p>&nbsp;</p><p>　　②-4.平均：avg(合計を調べたいカラム）</p><p>　　　　　例）select avg(score) from users;</p><p>&nbsp;</p><p>&nbsp;③ユニークな値だけを取得</p><p>　　select distinct ユニークな値を取り出したいカラム from テーブル名</p><p>　　例）select distinct team from users;</p><p>&nbsp; &nbsp; &nbsp;※ユニークな値がいくつあるか調べる</p><p>　　&nbsp; select count(distinct カラム) from テーブル名</p><p>　　　例）select count(distinct team) from users;</p><p>&nbsp;</p><p><span style="font-weight:bold;"><span style="color:#009944;">//グループ集計</span></span></p><p>　①グループごとに集計を出す方法</p><p>　　select sum(集計したいカラム) from テーブル名 group by グループ名;</p><p>&nbsp; &nbsp; 例）select sum(score) from users group by team;</p><p>&nbsp;</p><p>　②グループで集計したものに条件を付ける</p><p>　　select sum(集計したいカラム) from テーブル名 group by グループ名 having 条件</p><p>　　例）select sum(score) from users group by team having sum(score) &gt;10.0;</p><p>　　⇒scoreの合計値が10.0より大きいチームのみ表示</p><p>&nbsp;</p><p>　</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/saraden0502/entry-12410498392.html</link>
<pubDate>Mon, 08 Oct 2018 18:03:32 +0900</pubDate>
</item>
<item>
<title>プログラミング備忘録　＃32(MySQL</title>
<description>
<![CDATA[ <p>プログラミング備忘録　＃<font face="Liberation Serif, serif"><font size="3">32(MySQL</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>フィールド（カラム）を新たに追加する場合</b></font></p><p><font face="Liberation Serif, serif"><font size="3">alter table </font></font>テーブル名　<font face="Liberation Serif, serif"><font size="3">add column </font></font>追加するカラム 追加するカラムの型</p><p>例）<font face="Liberation Serif, serif"><font size="3">alter table users add column email varchar(255);</font></font></p><p><br>&nbsp;</p><p>　※●●の次に追加したい場合</p><p>　<font face="Liberation Serif, serif"><font size="3">alter table users add column email varchar(255) after ●●</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>カラムを削除する場合</b></font></p><p><font face="Liberation Serif, serif"><font size="3">alter table </font></font>テーブル名&nbsp;<font face="Liberation Serif, serif"><font size="3">drop column </font></font>カラム名</p><p>例）<font face="Liberation Serif, serif"><font size="3">alter table users drop column score;</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>カラムやカラムの型を変更する場合</b></font></p><p><font face="Liberation Serif, serif"><font size="3">alter table users change </font></font>変更前のカラム　変更後のカラム　カラムの型</p><p>例）<font face="Liberation Serif, serif"><font size="3">alter table users change user_name varchar(80);</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>テーブルの名前を変更</b></font></p><p><font face="Liberation Serif, serif"><font size="3">alter table </font></font>変更前の名前&nbsp;<font face="Liberation Serif, serif"><font size="3">rename </font></font>変更後の名前</p><p>例）<font face="Liberation Serif, serif"><font size="3">alter table users rename persons;</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>レコードの抽出</b></font></p><p>　①すべてのレコードを表示する場合</p><p>　　<font face="Liberation Serif, serif"><font size="3">select * from </font></font>テーブル名<font face="Liberation Serif, serif"><font size="3">;</font></font></p><p>　　例）<font face="Liberation Serif, serif"><font size="3">select * from users;</font></font></p><p>&nbsp; &nbsp; ※<font face="Liberation Serif, serif"><font size="3">select</font></font>：抽出</p><p>　　　<font face="Liberation Serif, serif"><font size="3">*</font></font>：すべての</p><p>　　　<font face="Liberation Serif, serif"><font size="3">from users;users</font></font>のテーブルの中から</p><p><br>&nbsp;</p><p>　②選択したカラムのみ表示</p><p>　　 <font face="Liberation Serif, serif"><font size="3">select </font></font>表示したいカラム <font face="Liberation Serif, serif"><font size="3">from </font></font>テーブル名</p><p>　　例）<font face="Liberation Serif, serif"><font size="3">select id,name from users;</font></font></p><p>　　　　※<font face="Liberation Serif, serif"><font size="3">users</font></font>テーブルの<font face="Liberation Serif, serif"><font size="3">id,name</font></font>のみ表示</p><p>　</p><p>　③条件付きで表示する場合</p><p>　　<font face="Liberation Serif, serif"><font size="3">select * form </font></font>テーブル名　<font face="Liberation Serif, serif"><font size="3">where </font></font>条件</p><p>　　例<font face="Liberation Serif, serif"><font size="3">1</font></font>）<font face="Liberation Serif, serif"><font size="3">score</font></font>が<font face="Liberation Serif, serif"><font size="3">20</font></font>点以上の人のみ表示</p><p>　　<font face="Liberation Serif, serif"><font size="3">select * form users where score &gt;= 20;</font></font></p><p><br>&nbsp;</p><p>　　例<font face="Liberation Serif, serif"><font size="3">2</font></font>）<font face="Liberation Serif, serif"><font size="3">name</font></font>が<font face="Liberation Serif, serif"><font size="3">sample0</font></font>の人のみ表示</p><p>　　<font face="Liberation Serif, serif"><font size="3">select * from users where name = 'sample0';</font></font></p><p><br>&nbsp;</p><p>&nbsp; &nbsp; 例<font face="Liberation Serif, serif"><font size="3">3</font></font>）<font face="Liberation Serif, serif"><font size="3">name</font></font>が<font face="Liberation Serif, serif"><font size="3">sample0</font></font>または<font face="Liberation Serif, serif"><font size="3">sample1</font></font>の人のみ表示</p><p>　　<font face="Liberation Serif, serif"><font size="3">select * from users where name in ('sample0' , 'sample1');</font></font></p><p>　　※<font face="Liberation Serif, serif"><font size="3">1</font></font>）<font face="Liberation Serif, serif"><font size="3">null</font></font>の時：<font face="Liberation Serif, serif"><font size="3">is null</font></font>（<font face="Liberation Serif, serif"><font size="3">is not null)</font></font></p><p>　　※<font face="Liberation Serif, serif"><font size="3">2</font></font>）<font face="Liberation Serif, serif"><font size="3">and or not</font></font>等もあり</p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>文字列の抽出</b></font></p><p>&nbsp; ①部分一致</p><p>　　<font face="Liberation Serif, serif"><font size="3">select * from </font></font>テーブル名&nbsp;<font face="Liberation Serif, serif"><font size="3">where </font></font>カラム名&nbsp;<font face="Liberation Serif, serif"><font size="3">like '</font></font>部分一致したい文字％<font face="Liberation Serif, serif"><font size="3">'</font></font></p><p>&nbsp; &nbsp;例）<font face="Liberation Serif, serif"><font size="3">select * form users where name like 's%';</font></font></p><p>&nbsp; &nbsp; &nbsp;結果）<font face="Liberation Serif, serif"><font size="3">name</font></font>カラムの<font face="Liberation Serif, serif"><font size="3">s</font></font>から始まるレコードを抽出</p><p>　※<font face="Liberation Serif, serif"><font size="3">a</font></font>を含む場合　　　　：<font face="Liberation Serif, serif"><font size="3">%a%</font></font></p><p>　 　<font face="Liberation Serif, serif"><font size="3">a</font></font>が最後にある場合：<font face="Liberation Serif, serif"><font size="3">%a</font></font></p><p><br>&nbsp;</p><p>&nbsp; ②文字数一致（<font face="Liberation Serif, serif"><font size="3">3</font></font>文字の場合）</p><p>　<font face="Liberation Serif, serif"><font size="3">select * from </font></font>テーブル名 <font face="Liberation Serif, serif"><font size="3">where </font></font>カラム名 <font face="Liberation Serif, serif"><font size="3">like '___';</font></font></p><p>　※<font face="Liberation Serif, serif"><font size="3">2</font></font>文字目が<font face="Liberation Serif, serif"><font size="3">a</font></font>の場合</p><p>　　<font face="Liberation Serif, serif"><font size="3">select * fom </font></font>テーブル名 <font face="Liberation Serif, serif"><font size="3">where </font></font>カラム名 <font face="Liberation Serif, serif"><font size="3">like '_a_';</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>並び替え</b></font></p><p>　①小さい順に並べる</p><p>&nbsp; <font face="Liberation Serif, serif"><font size="3">select * from </font></font>テーブル名 <font face="Liberation Serif, serif"><font size="3">order by </font></font>並べたいカラム</p><p>　例）<font face="Liberation Serif, serif"><font size="3">select * from users where order by score;</font></font></p><p>&nbsp; ※<font face="Liberation Serif, serif"><font size="3">null</font></font>を省く場合</p><p>　<font face="Liberation Serif, serif"><font size="3">select * from </font></font>テーブル名 <font face="Liberation Serif, serif"><font size="3">where score is not null order by </font></font>カラム名<font face="Liberation Serif, serif"><font size="3">;</font></font></p><p>　</p><p>　②大きい順に並べる</p><p>　<font face="Liberation Serif, serif"><font size="3">select * from </font></font>テーブル名 <font face="Liberation Serif, serif"><font size="3">order by </font></font>カラム名 <font face="Liberation Serif, serif"><font size="3">desc;</font></font></p><p><br>&nbsp;</p><p>　③表示する上限を決める</p><p>　<font face="Liberation Serif, serif"><font size="3">select * from </font></font>テーブル名 <font face="Liberation Serif, serif"><font size="3">limit </font></font>表示したい数<font face="Liberation Serif, serif"><font size="3">;</font></font></p><p>　例）<font face="Liberation Serif, serif"><font size="3">select * from users limit 3;</font></font></p><p>　※最初の何名かを除外する場合</p><p>　<font face="Liberation Serif, serif"><font size="3">select * from </font></font>テーブル名 <font face="Liberation Serif, serif"><font size="3">limit </font></font>除外したい数 <font face="Liberation Serif, serif"><font size="3">offset </font></font>表示したい数<font face="Liberation Serif, serif"><font size="3">;</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>レコードの更新</b></font></p><p>　①全てのレコードの任意のカラムの値を設定</p><p>　<font face="Liberation Serif, serif"><font size="3">update </font></font>テーブル名 <font face="Liberation Serif, serif"><font size="3">set </font></font>カラム名 <font face="Liberation Serif, serif"><font size="3">= </font></font>設定したい値<font face="Liberation Serif, serif"><font size="3">;</font></font></p><p>&nbsp; 例）<font face="Liberation Serif, serif"><font size="3">update users set score = 5.0;</font></font></p><p><br>&nbsp;</p><p>&nbsp; ②条件に応じて任意のカラムの値を設定</p><p>　<font face="Liberation Serif, serif"><font size="3">update </font></font>テーブル名 <font face="Liberation Serif, serif"><font size="3">set </font></font>カラム名 <font face="Liberation Serif, serif"><font size="3">= </font></font>設定したい値 <font face="Liberation Serif, serif"><font size="3">where </font></font>条件<font face="Liberation Serif, serif"><font size="3">;</font></font></p><p>&nbsp; 例）<font face="Liberation Serif, serif"><font size="3">update users set score = 5.0 where id = 1;</font></font></p><p>&nbsp; ※複数設定したい場合</p><p>　<font face="Liberation Serif, serif"><font size="3">update </font></font>テーブル名 <font face="Liberation Serif, serif"><font size="3">set </font></font>設定したいカラム<font face="Liberation Serif, serif"><font size="3">1 = </font></font>値<font face="Liberation Serif, serif"><font size="3">, </font></font>設定したいカラム<font face="Liberation Serif, serif"><font size="3">2 = </font></font>値 <font face="Liberation Serif, serif"><font size="3">where </font></font>条件<font face="Liberation Serif, serif"><font size="3">;</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>データを削除</b></font></p><p>　①テーブル内の全てを削除</p><p>　<font face="Liberation Serif, serif"><font size="3">delete from </font></font>テーブル名</p><p>　例）<font face="Liberation Serif, serif"><font size="3">delete from users;</font></font></p><p><br>&nbsp;</p><p>&nbsp; ②条件付き削除</p><p>　<font face="Liberation Serif, serif"><font size="3">delete from </font></font>テーブル名 <font face="Liberation Serif, serif"><font size="3">where </font></font>条件<font face="Liberation Serif, serif"><font size="3">;</font></font></p><p>&nbsp; 例）<font face="Liberation Serif, serif"><font size="3">delete from users where score &gt;= 5.0;</font></font></p><p>&nbsp;&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>数値の計算</b></font></p><p>&nbsp; ①条件に応じて値を計算</p><p>　<font face="Liberation Serif, serif"><font size="3">update </font></font>テーブル名 <font face="Liberation Serif, serif"><font size="3">set </font></font>カラム名 <font face="Liberation Serif, serif"><font size="3">= </font></font>どうしたいか記載 <font face="Liberation Serif, serif"><font size="3">where </font></font>条件</p><p>　例）<font face="Liberation Serif, serif"><font size="3">update users set score = score * 1.2 where id % 2 = 0;</font></font></p><p>　⇒<font face="Liberation Serif, serif"><font size="3">ID</font></font>が偶数の人の<font face="Liberation Serif, serif"><font size="3">score</font></font>は<font face="Liberation Serif, serif"><font size="3">1.2</font></font>倍</p><p><br>&nbsp;</p><p>　②数値の丸め（四捨五入</p><p>　　　①<font face="Liberation Serif, serif"><font size="3">-1.round</font></font>を用いた四捨五入</p><p>　　　　　　<font face="Liberation Serif, serif"><font size="3">select round(</font></font>丸めたい値<font face="Liberation Serif, serif"><font size="3">);</font></font></p><p>&nbsp; 　　　　　例）<font face="Liberation Serif, serif"><font size="3">select round(5.3) ⇒ 5</font></font></p><p>　　　　　　※小数第<font face="Liberation Serif, serif"><font size="3">2</font></font>位で四捨五入</p><p>　　　　　　<font face="Liberation Serif, serif"><font size="3">select round(</font></font>丸めたい値 <font face="Liberation Serif, serif"><font size="3">, 1);</font></font></p><p><br>&nbsp;</p><p>&nbsp;　　 ①<font face="Liberation Serif, serif"><font size="3">-2.floor</font></font>を用いた値の切り下げ</p><p>　　　　　　<font face="Liberation Serif, serif"><font size="3">select floor(</font></font>値<font face="Liberation Serif, serif"><font size="3">) ⇒</font></font>　切り下げて表示</p><p>　　　　　　例）<font face="Liberation Serif, serif"><font size="3">select floor(2.5) ⇒ 2</font></font></p><p><br>&nbsp;</p><p>　　 ①<font face="Liberation Serif, serif"><font size="3">-3.cei</font></font>ｌを用いた値の切り上げ</p><p>　　　　　　<font face="Liberation Serif, serif"><font size="3">select ceil(</font></font>値<font face="Liberation Serif, serif"><font size="3">)&nbsp; ⇒ </font></font>切り上げて表示</p><p>　　　　　　例）<font face="Liberation Serif, serif"><font size="3">select ceil(2.3) ⇒ 3</font></font></p><p><br>&nbsp;</p><p>　③ランダムな値の表示</p><p>　　<font face="Liberation Serif, serif"><font size="3">select rand();</font></font></p><p>　　※抽選を行う場合</p><p>　　　　<font face="Liberation Serif, serif"><font size="3">select * from users order by rand() limit 1;</font></font></p><p><br>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/saraden0502/entry-12410453436.html</link>
<pubDate>Mon, 08 Oct 2018 14:13:34 +0900</pubDate>
</item>
<item>
<title>プログラミング備忘録　＃31(MySQL</title>
<description>
<![CDATA[ <p>プログラミング備忘録　＃<font face="Liberation Serif, serif"><font size="3">31(MySQL</font></font></p><p><br>&nbsp;</p><p>外部ファイルを実行する方法</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>データベースの作成</b></font></p><p><font face="Liberation Serif, serif"><font size="3">create database myapp;</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//myapp</b></font></font><b>のすべてのテーブルの権限を</b><font face="Liberation Serif, serif"><font size="3"><b>myapp_user</b></font></font><b>に与えている（</b><font face="Liberation Serif, serif"><font size="3"><b>Pass</b></font></font><b>というパスワードが必要）</b></font></p><p><font face="Liberation Serif, serif"><font size="3">grant all on myapp .* to myapp_user@localhost identified by "Pass"</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>コメント方法（</b><font face="Liberation Serif, serif"><font size="3"><b>1</b></font></font><b>行の場合</b></font></p><p><font face="Liberation Serif, serif"><font size="3">-- coment</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>コメント方法（複数の場合</b></font></p><p><font face="Liberation Serif, serif"><font size="3">/*</font></font></p><p>　<font face="Liberation Serif, serif"><font size="3">coment</font></font></p><p><font face="Liberation Serif, serif"><font size="3">*/</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>外部ファイル実行方法</b></font></p><p>①リダイレクションを用いた方法</p><p><font face="Liberation Serif, serif"><font size="3">mysql -u root &lt; create_myapp.sql</font></font></p><p>　　<font face="Liberation Serif, serif"><font size="3">//</font></font>確認方法</p><p>　　<font face="Liberation Serif, serif"><font size="3">mysql -u myapp_user -p myapp</font></font>　</p><p>　　※<font face="Liberation Serif, serif"><font size="3">myapp_user </font></font>が パスワード有りの<font face="Liberation Serif, serif"><font size="3">myapp</font></font>にアクセスできるか確認</p><p><br>&nbsp;</p><p>②<font face="Liberation Serif, serif"><font size="3">MySQL</font></font>サーバーに接続している状態で確認する方法</p><p><font face="Liberation Serif, serif"><font size="3">mysql -u root&nbsp;</font></font></p><p><font face="Liberation Serif, serif"><font size="3">\. ./create_myapp.sql</font></font></p><p>接続で<font face="Liberation Serif, serif"><font size="3">k</font></font>ていたら、<font face="Liberation Serif, serif"><font size="3">OK</font></font>と表示される</p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>テーブルの作成方法</b></font></p><p><font color="#000000"><font face="Liberation Serif, serif"><font size="3">0.</font></font>データベースを作成、権限を渡す必要あり</font></p><p><font color="#000000">※<font face="Liberation Serif, serif"><font size="3">user</font></font>名を確認する方法</font></p><p><font color="#000000"><font face="Liberation Serif, serif"><font size="3">select Host, User ,Password from mysql.user;</font></font></font></p><p><font color="#000000">参考：</font><font face="Liberation Serif, serif"><font size="3"><a href="https://cloudpack.media/1316"><font color="#ff0000"><b>https://cloudpack.media/1316</b></font></a></font></font></p><p><br>&nbsp;</p><p><font face="Liberation Serif, serif"><font size="3">1.</font></font>データベースを使用するコマンドを打つ</p><p><font face="Liberation Serif, serif"><font size="3"><b>use </b></font></font><b>データベース名</b></p><p><b>例）</b><font face="Liberation Serif, serif"><font size="3"><b>use myapp;</b></font></font></p><p><b>参考：</b><font face="Liberation Serif, serif"><font size="3"><a href="https://blogs.yahoo.co.jp/tbyyd280/28688132.html?__ysp=TXlzcWwgdGFibGUg5L2c5oiQIE5vIGRhdGFiZXNlIHNlbGVjdGVk"><b>https://blogs.yahoo.co.jp/tbyyd280/28688132.html?__ysp=TXlzcWwgdGFibGUg5L2c5oiQIE5vIGRhdGFiZXNlIHNlbGVjdGVk</b></a></font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>データベースの作成</b></font></p><p><font face="Liberation Serif, serif"><font size="3">create table </font></font>テーブル名<font face="Liberation Serif, serif"><font size="3">(</font></font></p><p>&nbsp;それぞれのカラムの定義</p><p><font face="Liberation Serif, serif"><font size="3">);</font></font></p><p>例）</p><p><font face="Liberation Serif, serif"><font size="3">create table users(</font></font></p><p>&nbsp; <font face="Liberation Serif, serif"><font size="3">id int unsigned,&nbsp;</font></font></p><p>&nbsp;<font face="Liberation Serif, serif"><font size="3">name varchar(20),</font></font></p><p>&nbsp;<font face="Liberation Serif, serif"><font size="3">score float</font></font></p><p><font face="Liberation Serif, serif"><font size="3">);</font></font></p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>テーブルの一覧</b></font></p><p><font face="Liberation Serif, serif"><font size="3">show tables;</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>テーブルの構造確認</b></font></p><p><font face="Liberation Serif, serif"><font size="3">desc users;</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>テーブルの削除</b></font></p><p><font face="Liberation Serif, serif"><font size="3">drop table </font></font>テーブル名</p><p>例）<font face="Liberation Serif, serif"><font size="3">drop table user;</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//mysql</b></font></font><b>でよく使うデータ型</b></font></p><p>・数値</p><p><font face="Liberation Serif, serif"><font size="3">- int</font></font></p><p><font face="Liberation Serif, serif"><font size="3">- float&nbsp;</font></font></p><p><font face="Liberation Serif, serif"><font size="3">- double&nbsp;</font></font></p><p><font face="Liberation Serif, serif"><font size="3">- int unsigned</font></font></p><p>・文字列</p><p><font face="Liberation Serif, serif"><font size="3">- char</font></font></p><p><font face="Liberation Serif, serif"><font size="3">- varchar</font></font></p><p><font face="Liberation Serif, serif"><font size="3">- text</font></font></p><p>・日時</p><p><font face="Liberation Serif, serif"><font size="3">- date</font></font></p><p><font face="Liberation Serif, serif"><font size="3">- time</font></font></p><p><font face="Liberation Serif, serif"><font size="3">- datetime '2017-07-22 17:22:33'</font></font></p><p>・真偽値</p><p><font face="Liberation Serif, serif"><font size="3">- boolean -&gt; tinyint(1)</font></font></p><p>&nbsp; &nbsp;<font face="Liberation Serif, serif"><font size="3">true -&gt;&nbsp; 1</font></font></p><p>&nbsp; &nbsp;<font face="Liberation Serif, serif"><font size="3">false -&gt; 0</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>レコードの挿入</b></font></p><p><font face="Liberation Serif, serif"><font size="3">insert into </font></font>テーブル名（テーブルの要素） <font face="Liberation Serif, serif"><font size="3">values</font></font>（レコードの値）</p><p>例）<font face="Liberation Serif, serif"><font size="3">insert into users (id , name ,score) values(1,'sample',10);</font></font></p><p>※値を入れたくない場合は「<font face="Liberation Serif, serif"><font size="3">null</font></font>」でも可能</p><p><br>&nbsp;</p><p>　複数入れる場合</p><p>　<font face="Liberation Serif, serif"><font size="3">insert into users(id , name .score) values(1,'samle0',10) , (2,'sample1',20) , (3,'sample3',30);</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//</b></font></font><b>テーブルの表示方法</b></font></p><p><font face="Liberation Serif, serif"><font size="3">select * form </font></font>テーブル名</p><p>例）<font face="Liberation Serif, serif"><font size="3">select * from users;</font></font></p><p><br>&nbsp;</p><p><font color="#009944"><font face="Liberation Serif, serif"><font size="3"><b>//createTable</b></font></font><b>の際にフィールドに制限</b></font></p><p>　<font color="#009944">①</font><font color="#009944"><b>値に</b></font><font face="Liberation Serif, serif"><font size="3"><font color="#009944"><b>null</b></font></font></font><font color="#009944"><b>があればエラーを吐く方法（</b></font><font face="Liberation Serif, serif"><font size="3"><font color="#009944"><b>ID</b></font></font></font><font color="#009944"><b>が</b></font><font face="Liberation Serif, serif"><font size="3"><font color="#009944"><b>null</b></font></font></font><font color="#009944"><b>の時）</b></font></p><p>　<font face="Liberation Serif, serif"><font size="3">create table </font></font>テーブル名<font face="Liberation Serif, serif"><font size="3">(</font></font></p><p>&nbsp; &nbsp; <font face="Liberation Serif, serif"><font size="3">id int unsigned not null</font></font></p><p>&nbsp; &nbsp; <font face="Liberation Serif, serif"><font size="3">);</font></font></p><p><br>&nbsp;</p><p>&nbsp;<font color="#009944">②</font><font color="#009944"><b>デフォルト値を指定する方法（</b></font><font face="Liberation Serif, serif"><font size="3"><font color="#009944"><b>name</b></font></font></font><font color="#009944"><b>の値がない時）</b></font></p><p>　<font face="Liberation Serif, serif"><font size="3">create table </font></font>テーブル名<font face="Liberation Serif, serif"><font size="3">(</font></font></p><p>&nbsp; &nbsp; <font face="Liberation Serif, serif"><font size="3">id int unsigned,</font></font></p><p>&nbsp; &nbsp; <font face="Liberation Serif, serif"><font size="3">name varcher(20) default "hoge";</font></font></p><p>&nbsp; &nbsp;<font face="Liberation Serif, serif"><font size="3">);</font></font></p><p>&nbsp; ※レコードで<font face="Liberation Serif, serif"><font size="3">name</font></font>に値を入れない記述方法</p><p>　<font face="Liberation Serif, serif"><font size="3">insert into </font></font>テーブル名<font face="Liberation Serif, serif"><font size="3">(id , name) values(1);</font></font></p><p><br>&nbsp;</p><p>&nbsp;<font color="#009944">③</font><font color="#009944"><b>重複するとエラーを吐く方法</b></font></p><p>　<font face="Liberation Serif, serif"><font size="3">create table </font></font>テーブル名<font face="Liberation Serif, serif"><font size="3">(</font></font></p><p>&nbsp; <font face="Liberation Serif, serif"><font size="3">id int unsigned unique;</font></font></p><p>&nbsp; <font face="Liberation Serif, serif"><font size="3">);</font></font></p><p><br>&nbsp;</p><p><font color="#009944">&nbsp;④<b>主キーの設定方法（</b><font face="Liberation Serif, serif"><font size="3"><b>ID</b></font></font><b>を主キーとしている）</b></font></p><p>　<font face="Liberation Serif, serif"><font size="3">create table </font></font>テーブル名<font face="Liberation Serif, serif"><font size="3">(</font></font></p><p>&nbsp;<font face="Liberation Serif, serif"><font size="3">id int unsigned primary key;</font></font></p><p>&nbsp;<font face="Liberation Serif, serif"><font size="3">);</font></font></p><p>&nbsp;</p><p><font color="#009944">&nbsp;④<font face="Liberation Serif, serif"><font size="3"><b>-1</b></font></font><b>主キーに自動的に連番を付ける方法</b></font></p><p>&nbsp; &nbsp; &nbsp; &nbsp;（何もデータがなければ、自動的に番号が付与される）</p><p>　<font face="Liberation Serif, serif"><font size="3">create table </font></font>テーブル名<font face="Liberation Serif, serif"><font size="3">(</font></font></p><p>&nbsp;<font face="Liberation Serif, serif"><font size="3">id int unsigned primary key auto_increment;</font></font></p><p>&nbsp;<font face="Liberation Serif, serif"><font size="3">);</font></font></p><p><br>&nbsp;</p><p><br>&nbsp;</p><p><br>&nbsp;</p><p><br>&nbsp;</p><p><br><br>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/saraden0502/entry-12410291580.html</link>
<pubDate>Sun, 07 Oct 2018 20:08:40 +0900</pubDate>
</item>
</channel>
</rss>
