関係データベースやフラットファイルデータベースにおける表(ひょう)またはテーブル(英語: table)とは、データ要素(値)の集合を垂直な列と水平の行のモデルで構成したものである。表には所定の個数の列があるが、行数は不定である。各行は特定の列の値で識別され、それを候補キーと呼ぶ。
表は関係と同じ意味でも使われる。ただし、表は多重集合がありうるが、関係モデルにおける関係は重複を許さない点が異なる。実際のデータ行の他に、表にはその表や特定の列での値に関する制約のような何らかのメタ情報が対応しているのが一般的である。
表内のデータはデータベースに物理的に格納されている必要はない。ビューも一種の表だが、そのデータはクエリ時に計算で求められる。また、別のデータベース内の表へのポインタとして機能するニックネームもある。 関係データベース以外(階層型データモデルなど)では、表にほぼ相当するものとして構造化ファイルがあり、レコードが表の行に相当し、レコードのカラムが列に相当する。 表計算ソフトとは異なり、各フィールドのデータ型は、表を表すスキーマで定義されているのが普通である。関係データベースによっては、フィールドのデータ型定義が厳密でないものもある。 関係モデルでは、表は関係を表現したものと見なすことができるが、両者は厳密には同じではない。例えば、SQLにおける表は重複した行を含みうるが、真の関係では重複した組 (タプル) はあり得ない。同様に、表として表現すると列と行が順序という情報を持つことになるが、関係には順序は存在しない。このためSQLにおける表は行の順序を保存しないが、必要ならば、SELECT文で ORDER BY 節により順序を指定できる。 関係の他の等価な表現としては、n-次元グラフがある。この場合の n は属性数(表の列数)に相当する。例えば、2つの属性の関係と3つの値があるとき、表で表すと2列×3行の表になるが、2次元グラフ上の3つの点としても表せる。表とグラフが表現として等価と言えるのは、列間の順序が重要ではない場合で、表に重複する列がない場合である。
他のデータ構造との比較
表と関係
関連項目
関係 (データベース)
組 (データベース)
属性 (データベース)
テーブル (情報)
表
話
編
歴
この項目は、ソフトウェアに関連した書きかけの項目です。この項目を加筆・訂正などしてくださる協力者を求めています(PJ:コンピュータ/P:コンピュータ)。
.mw-parser-output .hlist ul,.mw-parser-output .hlist ol{padding-left:0}.mw-parser-output .hlist li,.mw-parser-output .hlist dd,.mw-parser-output .hlist dt{margin-right:0;display:inline-block;white-space:nowrap}.mw-parser-output .hlist dt:after,.mw-parser-output .hlist dd:after,.mw-parser-output .hlist li:after{white-space:normal}.mw-parser-output .hlist li:after,.mw-parser-output .hlist dd:after{content:" ・\a0 ";font-weight:bold}.mw-parser-output .hlist dt:after{content:": "}.mw-parser-output .hlist-pipe dd:after,.mw-parser-output .hlist-pipe li:after{content:" |\a0 ";font-weight:normal}.mw-parser-output .hlist-hyphen dd:after,.mw-parser-output .hlist-hyphen li:after{content:" -\a0 ";font-weight:normal}.mw-parser-output .hlist-comma dd:after,.mw-parser-output .hlist-comma li:after{content:"、";font-weight:normal}.mw-parser-output .hlist-slash dd:after,.mw-parser-output .hlist-slash li:after{content:" /\a0 ";font-weight:normal}.mw-parser-output .hlist dd:last-child:after,.mw-parser-output .hlist dt:last-child:after,.mw-parser-output .hlist li:last-child:after{content:none}.mw-parser-output .hlist dd dd:first-child:before,.mw-parser-output .hlist dd dt:first-child:before,.mw-parser-output .hlist dd li:first-child:before,.mw-parser-output .hlist dt dd:first-child:before,.mw-parser-output .hlist dt dt:first-child:before,.mw-parser-output .hlist dt li:first-child:before,.mw-parser-output .hlist li dd:first-child:before,.mw-parser-output .hlist li dt:first-child:before,.mw-parser-output .hlist li li:first-child:before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child:after,.mw-parser-output .hlist dd dt:last-child:after,.mw-parser-output .hlist dd li:last-child:after,.mw-parser-output .hlist dt dd:last-child:after,.mw-parser-output .hlist dt dt:last-child:after,.mw-parser-output .hlist dt li:last-child:after,.mw-parser-output .hlist li dd:last-child:after,.mw-parser-output .hlist li dt:last-child:after,.mw-parser-output .hlist li li:last-child:after{content:")\a0 ";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li:before{content:" "counter(listitem)" ";white-space:nowrap}.mw-parser-output .hlist dd ol>li:first-child:before,.mw-parser-output .hlist dt ol>li:first-child:before,.mw-parser-output .hlist li ol>li:first-child:before{content:" ("counter(listitem)" "}.mw-parser-output .navbar{display:inline;font-size:75%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}.mw-parser-output .infobox .navbar{font-size:88%}.mw-parser-output .navbox .navbar{display:block;font-size:88%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em}