- ããŒã¿ããŒã¹ã«æ¥ç¶ããã¯ã©ã¹ãäœæããŸã
- ããŒã¿ãæäœããããã®ã¢ãã«ã¯ã©ã¹ãäœæãã
æåã®ã¿ã¹ã¯ã¯éåžžã«è¿ éã«è§£æ±ºãããŸããã ãããå®è£ ããããã«ãSingletonãã¶ã€ã³ãã¿ãŒã³ã䜿çšããŸããã
2çªç®ã®ã¿ã¹ã¯ãå®è£ ããã«ã¯ãããå°ãæéãå¿ èŠã§ããã åºæ¬ã¯ããµã€ãäžã®ã·ã³ãã«ãªãã¥ãŒã¹ç®¡çã¢ãžã¥ãŒã«ã§ããã ãã®ã¢ãžã¥ãŒã«ã®åœ¹å²ã«ã¯ãã¬ã³ãŒãã®éžæãäœæãåé€ãããã³æŽæ°ã®æšæºæ©èœã»ãããå«ãŸããŠããŸããã ã¢ãã«ã¯ã©ã¹ã¯ãããŒã¿ããŒã¹ãžã®æ¥ç¶ãå®éã«äœæããDataBaseã¯ã©ã¹ãç¶æ¿ããŸãã ãŸãããã®ã¯ã©ã¹ã¯ã DMLæäœã® sqlã³ãŒããçæããŸã ã DataBaseã¯ã©ã¹ã¯æœè±¡ã§ããããã¹ãŠã®åã¯ã©ã¹ã«DMLã¡ãœãããå®è£ ããå¿ èŠããããŸãã
以äžã¯ãNewsã¢ãžã¥ãŒã«ã®ç®¡çãæ åœããæœè±¡ã¡ãœããã®ã»ããã§ãã
// abstract public function getRecords($what='*',$where=NULL, $limit=NULL, $order=NULL,$join=NULL,$debug=false); // abstract function addRecord($data=array(),$debug=false); // (-) abstract function deleteRecords($table, $where=NULL,$debug=false); // (-) abstract function setRecords($table,$what,$where,$debug=false); // abstract function query($sql);
次ã«ãåæœè±¡ã¡ãœããã«ã€ããŠè©³ãã説æããŸãã ãããã®ã¡ãœããã®å®è£ ã«ã€ããŠã¯ãNewsã¢ãã«ã®ã¯ã©ã¹ã説æãããšãã«ä»¥äžã«ç€ºããŸãã
å ¥åãã©ã¡ãŒã¿ãŒã®ããã€ãã¯ç¹°ãè¿ããããããæ¬åœã«å¿ èŠã§ãªãéããããããå説æããŸããã
GetRecordsã¡ãœãã
ãã®ã¡ãœããã䜿çšãããšãSQLã®æ¡ä»¶ã«é©åããã¬ã³ãŒãã®ã»ãããååŸã§ããŸãã
- $ what-ããŒãã«ããéžæãããã£ãŒã«ãã®é åãæž¡ããŸã
- $ where-ããŒã®é£æ³é åãé åã®åœ¢åŒã§æž¡ããŸãïŒ 'Field' => arrayïŒ 'sign'ã 'value'ïŒïŒã ããã«ãããWHEREè¿°éšãããæè»ã«äœ¿çšã§ããŸãã
- $ limit-é åã®åœ¢åŒã§ããŒã®é£æ³é åãæž¡ããŸãïŒãåæã¬ã³ãŒããããã¬ã³ãŒãæ°ãïŒã ãã®æ§é ã«ãããããŒãžããŒã·ã§ã³ãŸãã¯éãããæ°ã®ã¬ã³ãŒãã®åºåãå®è£ ã§ããŸã
- $ order-é£æ³é åé åïŒããã£ãŒã«ãã=>ããœãŒãã¿ã€ããïŒã ä»»æã®æ°ã®åã§ãœãŒãã§ããŸãã
- $ join-é£æ³é åé åïŒãæ¥ç¶ã¿ã€ãããé åïŒãTable1ãããTable2ãïŒãé åïŒãAlias1ãããAlias2ãïŒãé åïŒãfield1ãããfield2ãïŒïŒã éä¿¡ã¿ã€ãïŒå·Šãå åŽãå³åŽãå€åŽã è¡š1ããã³è¡š2ïŒéä¿¡ã確ç«ãããããŒãã«ã Allias1ãšAllias2ã¯ããŒãã«ã®ãšã€ãªã¢ã¹ã§ãã Field1ãšField2ã¯ããããã§ãã PKããã³FKããŒãã«
- $ degub-ãã®ãã©ã¡ãŒã¿ãŒã¯ãPDOã§prepareã¹ããŒãã¡ã³ãã䜿çšããå Žåã«å¿ èŠãªãã©ã¡ãŒã¿ãŒã ãã§ãªããæ¢ã«äœæãããSQLã¯ãšãªãã¯ã©ã¹ããããã£ã«ä¿åããããã«å¿ èŠã§ã
AddRecordã¡ãœãã
ãã®ã¡ãœããã䜿çšãããšãããŒãã«ã«ã¬ã³ãŒããè¿œå ã§ããŸãã
- $ data-'field' => 'value'ã®åœ¢åŒã®ãã©ã¡ãŒã¿ãŒã®é£æ³é åãããŒãã«ã«æ¿å ¥ãããŸã
DeleteRecordsã¡ãœãã
ãã®ã¡ãœããã䜿çšãããšãããŒãã«ããã¬ã³ãŒããåé€ã§ããŸãã
- $ table-ããŒã¿ãåé€ãããããŒãã«ã®åå
SetRecordsã¡ãœãã
ãã®ã¡ãœããã䜿çšãããšãæå®ããæ¡ä»¶ã«åŸã£ãŠããŒãã«å ã®ã¬ã³ãŒããæŽæ°ã§ããŸãã
- $ what-ãã®å Žåããã®ãã©ã¡ãŒã¿ãŒã¯ãSETæŒç®åã§äœ¿çšããã 'field' => 'value'ã®åœ¢åŒã§é åãæž¡ããŸã
ã¯ãšãªæ¹æ³
ãã®ã¡ãœããã䜿çšãããšãéæšæºã®ã¯ãšãªãå®è¡ã§ããŸãã ãããè¡ãã«ã¯ãã¡ãœããã«ãã©ã¡ãŒã¿ãŒãšããŠsqlã¯ãšãªãæž¡ãã ãã§ãã
- $ sql-å®è¡ããSQLã¯ãšãª
ã¯ãšãªã®DMLã¿ã€ãã¯ãSELECTãINSERTãUPDATEãDELETEã®4ã€ã®ã¿ã€ãã§æ§æãããŠããããšãå€ãã®äººãç¥ã£ãŠãããšæããŸãã ãããã®ã¯ãšãªãçæããã«ã¯ãæ¡ä»¶ä»ãã§ããã€ãã®éšåã«åå²ããå¿ èŠããããŸãã
1ïŒSELECTã¯ãšãªã¯ãWHATãJOINãWHEREãORDERãLIMITãGROUPãHAVINGã«åãããŠããŸãã
2ïŒINSERTãªã¯ãšã¹ãïŒäœ
3ïŒUPDATEã¯ãšãªïŒWHATãWHERE
4ïŒã¯ãšãªã®åé€ïŒWHEREã
ãªã¯ãšã¹ãã®ãããã®éšåãåå¥ã«çæããããããçµåããã ãã§ããããšãããããŸããã ãããã®ããŒããDataBaseã¯ã©ã¹ã§çæããããã«ããã®äŸã®ããã«Newsã¢ãžã¥ãŒã«ã ãã§ãªããä»ã®ã¢ãžã¥ãŒã«ã«ãå ±éããã¡ãœãããäœæãããŸããã
ãããã®æ¹æ³ããã詳现ã«æ€èšããŠãã ããã
CheckWhatã¡ãœãã
ãã®ã¡ãœãããžã®å¯äžã®å ¥åã¯ãSELECTã䜿çšããŠéžæããããUPDATEã䜿çšããŠæŽæ°ããå¿ èŠãããå€ã®é£æ³é åã§ãã
ããã§èª¬æãã $ whatãã©ã¡ãŒã¿ã
protected function checkWhat($what) { if (is_array($what)) { foreach ($what as $k=>$v) { if (!is_numeric($k)) // . , prepare statement, , SELECT { $result['column'][]=$k."=?"; $result['params'][]=$v; } else { $result['column'][]=$v; } } $result['column']=implode(",",$result['column']); } return $result; }
ããã§ã¯ãã¹ãŠãã¯ã£ããããŠãããšæããŸãã é åããã§ãã¯ããé åã®ãã¹ãŠã®èŠçŽ ãèµ°æ»ããã¯ãšãªæååã®äžéšãæ§ç¯ããŸãã
CheckJoinã¡ãœãã
ããã§ã$ joinãã©ã¡ãŒã¿ã«ã€ããŠèª¬æããŸã ã ãŸãã3ã€ä»¥äžã®ããŒãã«ãçµåããå¿ èŠãããå Žåã$çµåãã©ã¡ãŒã¿ãŒãé åïŒ$ join1ã$ join2ã.....ã$ joinNïŒãšããŠè¡šãããšãã§ããŸã
// Join . protected function checkJoin($join) { if (is_array($join) && count($join)>0) { if (!is_array($join[0])) // , join { $res[]=$this->addJoin($join[0],$join[1],$join[2],$join[3]); } else { // , join $res=$this->addJoinArray($join); } return implode(" ",$res); } else { return false; } } // join protected function addJoin($type=' INNER ',$tables,$pseudoName,$rows) { if ($type!=='' && is_array($tables) && is_array($rows)) { $t0=$tables[0]; $t1=$tables[1]; if (is_array($pseudoName) && count($pseudoName)>0) // , { $t0=$pseudoName[0]; $t1=$pseudoName[1]; } return $type." JOIN `".$tables[1]."` `".$pseudoName[1]."` ON `".$t0."`.`".$rows[0]."`=`".$t1."`.`".$rows[1]."`"; } else { return false; } } // join` protected function addJoinArray($join) { if (is_array($join)) { foreach ($join as $j) { $res[]=$this->addJoin($j[0],$j[1],$j[2],$j[3]); } } return $res; }
CheckWhereã¡ãœãã
ãã®ã¡ãœããã¯ããªã¯ãšã¹ãã®WHEREã³ã³ããŒãã³ãã®ãã©ã¡ãŒã¿ãŒããã§ãã¯ããŸãã ããã§ã$ whereãã©ã¡ãŒã¿ã«ã€ããŠèª¬æããŸãã
protected function checkWhere($where) { if (!is_null($where) && is_array($where)) { foreach ($where as $k=>$v) { $part=$k.$v[0]; // '' '' if (!is_array($v[1])) // , prepare statement { $part.="?"; $params[]=$v[1]; // } else { // , IN (array) $part.="(".implode(",",$v[1]).")"; } $res[]=$part; } $result['column']="WHERE ".implode(" AND ",$res); $result['params']=$params; } return $result; }
CheckLimitã¡ãœãã
LIMITã¯ãšãªã®è¿°èªãçæããŸãã ããã§ã¯ãã¹ãŠãéåžžã«ç°¡åã§ãã
protected function checkLimit($limit) { $res=false; if (is_array($limit) && count($limit)>0) { $res=" LIMIT ".$limit['start']; if (isset($limit['count']) && $limit['count']!=='') // { $res.=", ".$limit['count']; } } return $res; }
CheckOrderã¡ãœãã
ORDERè¿°èªã®çæã
protected function checkOrder($order) { if (is_array($order) && count($order)>0) { foreach ($order as $row=>$dir) { $res[]=$row." ".$dir; } return "ORDER BY ".implode(",",$res); } else { return false; } }
ãããããªã¯ãšã¹ãã®äž»èŠéšåãçæããããã«å¿ èŠãªãã¹ãŠã®ã¡ãœããã§ãã ããããä»¥æ¥ WHEREããã³WHATãªã©ã®ã¯ãšãªã®éšåã§prepareã¹ããŒãã¡ã³ãã䜿çšããããããããã®éšåã®ãã©ã¡ãŒã¿ãŒãçµåããŠPDOã«æž¡ãå¿ èŠããããŸãã ãã®ã¿ã¹ã¯ã®ããã«ãå¥ã®ã¡ãœãããæžããŸãã
CheckParamsã¡ãœãã
å ¥åãã©ã¡ãŒã¿ãŒã¯2ã€ã®é åã§ãã WHATããã³WHEREãã©ã¡ãŒã¿ãŒã®é åã
protected function checkParams($what,$where) { if (!isset($what) || !is_array($what)) { $params=$where; } else if (!isset($where) && !is_array($where)) { $params=$what; } else { $params=array_merge($what,$where); } return $params; }
SQLã¯ãšãªãæ§ç¯ãã次ã®ã¹ãããã¯ãSQLã³ãŒãã®æçµçæã§ãã ãã®ããã«ãprepareSelectSQLãprepareInsertSQLãprepareDeleteSQLãprepareUpdateSQLã®4ã€ã®ã¡ãœãããäœæããŸãã
ãããã®æ¹æ³ããã詳现ã«æ€èšããŠãã ããã
PrepareSelectSQLã¡ãœãã
ãã®ã¡ãœããã®ãã©ã¡ãŒã¿ãŒã¯ãgetRecordsã¡ãœããã®ãã©ã¡ãŒã¿ãŒãšäžèŽããŸãã ããã¯ã$ whatã$ whereã$ limitã$ orderã$ joinã$ debugã§ãã ãããã®ãªãã·ã§ã³ã«ã€ããŠèª¬æããŸãã
protected function prepareSelectSQL($what=array('*'),$where=NULL, $limit=NULL, $order=NULL,$join=NULL,$debug=false) { $what=$this->checkWhat($what); $where=$this->checkWhere($where); $limit=$this->checkLimit($limit); $order=$this->checkOrder($order); $j=$this->checkJoin($join); $sql="SELECT ".$what['column']." FROM `".$this->table."` `tb` ".$j." ".$where['column']." ".$order." ".$limit; $params=$this->checkParams($what['params'],$where['params']); if ($debug) // true, sql . { $this->sql=$sql; $this->params=$params; } return array('sql'=>$sql,'params'=>$params); // sql . }
PrepareInsertSQLã¡ãœãã
ãã®æ¹æ³ã¯ããç°¡åã§ã éå®ãããè¿°èªãšãã©ã¡ãŒã¿ãŒã®ã»ããã䜿çšããŸã
protected function prepareInsertSQL($data,$table,$debug=false) { $params=$values=$column=array(); foreach ($data as $c=>$p) { $column[]=$c; // $values[]="?"; // prepare statement $params[]=$p; // } $sql=" INSERT INTO `".$table."` (".implode(",",$column).") VALUES (".implode(',',$values).")"; if ($debug) { $this->sql=$sql; $this->params=$params; } return array('sql'=>$sql,'params'=>$params); }
PrepareDeleteSQLã¡ãœãã
ã¬ã³ãŒããåé€ããèŠæ±ã WHEREè¿°éšã«ã¯ããŒãã«åãšäžé£ã®ãã©ã¡ãŒã¿ãŒã䜿çšããŸãã
protected function prepareDeleteSQL($table,$where,$debug=false) { $where=$this->checkWhere($where); $sql="DELETE FROM `".$table."` ".$where['column']; $params=$this->checkParams($what,$where['params']); if ($debug) { $this->sql=$sql; $this->params=$params; } return array('sql'=>$sql,'params'=>$params); }
PrepareUpdateSQLã¡ãœãã
ããŒãã«å ã®ã¬ã³ãŒããæŽæ°ããããã®SQLèŠæ±ãçæããŸãã
protected function prepareUpdateSQL($table,$what,$where,$debug=false) { $what=$this->checkWhat($what); $where=$this->checkWhere($where); $sql="UPDATE `".$table."` SET ".$what['column']." ".$where['column']; $params=$this->checkParams($what['params'],$where['params']); if ($debug) { $this->sql=$sql; $this->params=$params; } return array('sql'=>$sql,'params'=>$params); }
ããŒã¿ããŒã¹ãžã®æ¥ç¶ãšDML SQLã¯ãšãªã®çæãæ åœããDataBaseã¯ã©ã¹ã«ã€ããŠã¯äžèšã§èª¬æããŸããã 以äžã¯ããã®ã¯ã©ã¹ã®å®å šãªã³ãŒãã§ãã
æœè±¡ã¯ã©ã¹ã®ããŒã¿ããŒã¹
<? abstract class DataBase { static private $_db=NULL; public $sql=''; public $params=array(); /* * __construct __clone , * new. * */ private function __construct() { return false; } private function __clone() { return false; } // abstract public function getRecords($what='*',$where=NULL, $limit=NULL, $order=NULL,$join=NULL,$debug=false); // abstract function addRecord($data=array(),$debug=false); // (-) abstract function deleteRecords($table, $where=NULL,$debug=false); // (-) abstract function setRecords($table,$what,$where,$debug=false); // abstract function query($sql); /* * . , * , , * . * PDOChild * */ public static function getInstance($registry) { if (is_null(self::$_db)) { self::$_db=new PDOchild($registry); } return self::$_db; } /* * join . * type - join * tables - * pseudoName - * row - * */ protected function addJoin($type=' INNER ',$tables,$pseudoName,$rows) { if ($type!=='' && is_array($tables) && is_array($rows)) { $t0=$tables[0]; $t1=$tables[1]; if (is_array($pseudoName) && count($pseudoName)>0) { $t0=$pseudoName[0]; $t1=$pseudoName[1]; } return $type." JOIN `".$tables[1]."` `".$pseudoName[1]."` ON `".$t0."`.`".$rows[0]."`=`".$t1."`.`".$rows[1]."`"; } else { return false; } } /* * join * join - join array(join,join) * */ protected function addJoinArray($join) { if (is_array($join)) { foreach ($join as $j) { $res[]=$this->addJoin($j[0],$j[1],$j[2],$j[3]); } } return $res; } /* * SELECT sql * what- * where- array(=>array(=,)) * limit- array( , ) * order- array (=>) * join- join * debug- true sql sql params * */ protected function prepareSelectSQL($what=array('*'),$where=NULL, $limit=NULL, $order=NULL,$join=NULL,$debug=false) { $what=$this->checkWhat($what); $where=$this->checkWhere($where); $limit=$this->checkLimit($limit); $order=$this->checkOrder($order); $j=$this->checkJoin($join); $sql="SELECT ".$what['column']." FROM `".$this->table."` `tb` ".$j." ".$where['column']." ".$order." ".$limit; $params=$this->checkParams($what['params'],$where['params']); if ($debug) { $this->sql=$sql; $this->params=$params; } return array('sql'=>$sql,'params'=>$params); } /* * Insert sql * data- - * table- * debug- true sql sql params * */ protected function prepareInsertSQL($data,$table,$debug=false) { foreach ($data as $c=>$p) { $column[]=$c; $values[]="?"; $params[]=$p; } $sql=" INSERT INTO `".$table."` (".implode(",",$column).") VALUES (".implode(',',$values).")"; if ($debug) { $this->sql=$sql; $this->params=$params; } return array('sql'=>$sql,'params'=>$params); } /* * Delete sql * where- * table- * debug- true sql sql params * */ protected function prepareDeleteSQL($table,$where,$debug=false) { $where=$this->checkWhere($where); $sql="DELETE FROM `".$table."` ".$where['column']; $params=$this->checkParams($what,$where['params']); if ($debug) { $this->sql=$sql; $this->params=$params; } return array('sql'=>$sql,'params'=>$params); } /* * Update sql * table- * what - * where- * debug- true sql sql params */ protected function prepareUpdateSQL($table,$what,$where,$debug=false) { $what=$this->checkWhat($what); $where=$this->checkWhere($where); $sql="UPDATE `".$table."` SET ".$what['column']." ".$where['column']; $params=$this->checkParams($what['params'],$where['params']); if ($debug) { $this->sql=$sql; $this->params=$params; } return array('sql'=>$sql,'params'=>$params); } /* * join * , , addJoin * , addJoinArray * join , * */ protected function checkJoin($join) { if (is_array($join) && count($join)>0) { if (!is_array($join[0])) { $res[]=$this->addJoin($join[0],$join[1],$join[2],$join[3]); } else { $res=$this->addJoinArray($join); } return implode(" ",$res); } else { return false; } } /* * what * . , * =>? prepare SQL * */ protected function checkWhat($what) { if (is_array($what)) { foreach ($what as $k=>$v) { if (!is_numeric($k)) { $result['column'][]=$k."=?"; $result['params'][]=$v; } else { $result['column'][]=$v; } } $result['column']=implode(",",$result['column']); } return $result; } /* * Where * , * =>? prepare SQL * v[0](sign)= IN value , IN (array); * LIKE, . * sql * */ protected function checkWhere($where) { if (!is_null($where) && is_array($where)) { foreach ($where as $k=>$v) { $part=$k.$v[0]; if (!is_array($v[1])) { $part.="?"; $params[]=$v[1]; } else { $part.="(".implode(",",$v[1]).")"; } $res[]=$part; } $result['column']="WHERE ".implode(" AND ",$res); $result['params']=$params; } return $result; } /* * Limit * , * LIMIT SQL * LIMIT * */ protected function checkLimit($limit) { if (is_array($limit) && count($limit)>0) { $res=" LIMIT ".$limit['start']; if (isset($limit['count']) && $limit['count']!=='') { $res.=", ".$limit['count']; } } return $res; } /* * Order * , * ORDER SQL * ORDER * */ protected function checkOrder($order) { if (is_array($order) && count($order)>0) { foreach ($order as $row=>$dir) { $res[]=$row." ".$dir; } return "ORDER BY ".implode(",",$res); } else { return ''; } } /* * prepare sql * WHAT WHERE. * , prepare sql * update, select, delete, insert * what where * */ protected function checkParams($what,$where) { if (!isset($what) || !is_array($what)) { $params=$where; } else if (!isset($where) && !is_array($where)) { $params=$what; } else { $params=array_merge($what,$where); } return $params; } } ?>
ããã§ãNewsã¢ãã«ã¯ã©ã¹ã«ã€ããŠèª¬æããŸãã ãã®ã¯ã©ã¹ã¯ã芪DataBaseã¯ã©ã¹ã®ãã¹ãŠã®æœè±¡ã¡ãœãããšéçgetObjectã¡ãœãããå®è£ ããŸãã ãã®ã¡ãœããã¯ããã®ã¯ã©ã¹ã®ãªããžã§ã¯ãã®ã€ã³ã¹ã¿ã³ã¹ãè¿ããŸãã ãã®ã¡ãœããã¯ãnewããŒã¯ãŒãã䜿çšããŠNewsã¯ã©ã¹ã®ãªããžã§ã¯ããäœæããå¿ èŠããªããããã«äœæãããŸããã ããã¯æ¬¡ã®ãããªãã®ã§ãã
$news=News::getObject()->getRecords(params);
ãã®ã¯ã©ã¹ã®åã¡ãœããã¯ãå¿ èŠãªsqlã¯ãšãªãžã§ãã¬ãŒã¿ãŒãåŒã³åºããã¯ãšãªãå®è¡ããããã«æçµçãªã¯ãšãªãšãã©ã¡ãŒã¿ãŒãPDOã«æž¡ããŸãã 以äžã¯ãNewsã¢ãã«ã®å®å šãªã¯ã©ã¹ã³ãŒãã§ãã
ã¯ã©ã¹ãã¥ãŒã¹
<? class News extends DataBase { public $table='news'; // public $id_row='id'; // primary key public function __construct() { $registry=new Registry(); // $this->db=parent::getInstance($registry); } // public static function getObject() { return new News(); } // . public function getRecords($what=array('*'),$where=NULL, $limit=NULL, $order=NULL,$join=NULL,$debug=false) { $data=$this->prepareSelectSQL($what,$where, $limit, $order,$join,$debug); $res=$this->db->prepare($data['sql']); $res->execute($data['params']); $result=$query->fetchAll(PDO::FETCH_OBJ); return $result; } public function addRecord($data=array(),$debug=false) { $data=$this->prepareInsertSQL($data,$this->table,$debug); $query=$this->db->prepare($data['sql']); return $query->execute($data['params'])); } public function deleteRecords($table, $where=NULL,$debug=false) { $data=$this->prepareDeleteSQL($table,$where,$debug); $query=$this->db->prepare($data['sql']); $result=$query->execute($data['params']); return $result; } public function setRecords($table,$what,$where,$debug=false) { $data=$this->prepareUpdateSQL($table,$what,$where,$debug); $query=$this->db->prepare($data['sql']); $result=$query->execute($data['params']); return $result; } public function query($sql) { $query=$this->db->prepare($sql); $query->execute(); $result=$query->fetchAll(PDO::FETCH_OBJ); return $result; } } ?>
ååãšããŠãããã¯å®äºããããšãã§ããŸãã ãã¡ãããGROUP BYããã³HAVINGè¿°èªã®çæãè¿œå ããããšãã§ããŸãããç§ã¯ããããªãããšã«ããŸããã ç§ãæ確ã«è¿°ã¹ãã¯ãšãªãæ§ç¯ããåçã¯ã䜿çšã«åé¡ã¯ãªããšæããŸãã ãã®çµæãSQLã¯ãšãªãæ§ç¯ããã¡ã«ããºã ãåŸãããŸãããããã¯ãããŒã¿ããŒã¹å ã®ç¹å®ã®ããŒãã«æ§é ã«é¢é£ä»ããããŠããããããŸããŸãªã¿ã€ãã®DML SQLã¯ãšãªã«é©çšã§ããŸãã å¿ èŠã«å¿ããŠãgithubã«ãªããžããªãäœæã§ããŸãã
ã¡ãœãããæ¹åããããã®æ¹å€ãšææ¡ãèããŠããããã§ãã