ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

9-1-4 Create Select ·s¼W¸ê®Æªí

9-1-4 Create Select ·s¼W¸ê®Æªí

9-1-4   Create Select ·s¼W¸ê®Æªí
¦p¦ó±N¿z¿ï¥X¨Óªº¸ê®Æ¿ý¦s©ñ¨ì¤@­Ó·sªº¸ê®Æªí¤º¡]¸Ó¸ê®Æªí©|¥¼¦s¦b©ó¸ê®Æ®w¤¤¡^¡H¨Ï¥ÎInsert Into«ü¥O¬OÅK©w¤£¦æªº¡A¦]¬°Insert Into«ü¥O¥u¯à±N¸ê®Æ¦s¤J¡u¤w¸g¡v¦s¦bªº¸ê®Æªí¤º¡C¦pªG­n±N¸ê®Æ¦s¤J¤@­Ó©|¥¼¦s¦bªº¸ê®Æªí¤¤¡A§Ú­Ì¥i¥H¨Ï¥ÎCreate Select«ü¥O¡A·í§Ú­Ì¨Ï¥ÎCreate Select«ü¥O±N¸ê®Æ¦s¤J¸ê®Æªí¤§«e¡ACreate Select«ü¥O·|¥ý¦b¸ê®Æ®w¤¤«Ø¥ß¤@­Ó·sªº¸ê®Æªí«á¡A¦A±N¸ê®Æ¦s©ñ¶i¥h¡C

Create Select«ü¥O¦³¤TºØ¥Îªk¡G
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

·s¼W¸ê®Æªí¨Ã·s¼W¤@µ§¸ê®Æ¿ý
·s¼W¸ê®Æ¿ý
  1. Creat Table·s¸ê®Æªí¦WSelect ¡¥Äæ¦ì­È¡¦ As ¡¥Äæ¦ì¦W¡¦
½Æ»s¥N½X
¨Ò¦p¡G·s¼W¤@­Ó¦W¬°¡ujusttest¡vªº¸ê®Æªí¡A¨Ã©ó¸ê®Æªí¤º·s¼W¤@µ§Äæ¦ì¦WºÙ¬°¡u©m¦W¡v¡AÄæ¦ì­È¬°¡u§õ©ú©M¡v¡BÄæ¦ì¦WºÙ¬°¡umail¡v¡AÄæ¦ì­È¬°¡u[email protected]¡vªº¸ê®Æ¿ý¡A«h¨ä«ü¥O±Ô­z¦p¤U¡G
  1. Create Table justtest select '§õ©ú©M' As ©m¦W,'[email protected]' As mail
½Æ»s¥N½X
°õ¦æ¤W¦C«ü¥O±Ô­z«á¡A´N·|¦b¸ê®Æ®w¤¤·s¼W¤@­Ó¡ujusttest¡v¸ê®Æªí¡A¸ê®Æªí¤º¨Ã¦s¦³¤@µ§¸ê®Æ¡G

¹Ï9-18   «ü¥O°õ¦æµ²ªG¡C

ex09_06.php
  1. <?
  2.     $conn = mysql_connect("localhost", "root", "12345a");
  3.     if(mysql_select_db("STUDENTS", $conn))
  4.      {
  5.       //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
  6.       mysql_query("set character set big5");
  7.       //¸ê®Æ®w¦s¦b,«Ø¥ßSQL©R¥O¦r¦ê
  8.       $SQL="CREATE TABLE justtest
  9.                select '§õ©ú©M' As ©m¦W,'[email protected]' As mail";
  10.       //±N¦^¶Çµ²ªG¦s©ñ©óÅܼƤ¤
  11.       $datalist=mysql_query($SQL);
  12.      }
  13.     else
  14.      {
  15.       echo "¸ê®Æ®w¤£¦s¦b";
  16.      }
  17. ?>
½Æ»s¥N½X
ª`·N¡G¦pªG«ü©w·s¼Wªº¸ê®Æªí¦WºÙ¡A¬O¤w¸g¦s¦b©ó¸ê®Æ®wªº¸ê®Æªí¦WºÙ¡A«hCreate Select«ü¥O±Ô­z´N·|°õ¦æ¥¢±Ñ¡A¨Ò¦p¡G²Ä¤@¦¸°õ¦æ½d¨Òex09_06.php«á¡A¡ujusttest¡v¬O¤@­Ó¦s¦b©ó¸ê®Æ®w¤ºªº¸ê®Æªí¡A¦Ó§Ú­Ì¦A¦¸¨Ï¥ÎCreate Select«ü¥O±Ô­z®É¡A«o¤S±N·s¼Wªº¸ê®Æªí¦WºÙ©w¬°¡ujusttest¡v¡A«hCreate Select«ü¥O±Ô­z´N·|°õ¦æ¥¢±Ñ¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

½Æ»s¸ê®Æªí
±N¤w¸g¦s¦bªº¸ê®Æªí½Æ»s¤@¥÷¡A¨Ã±N¸ê®Æ¦s¤J·s«Øªº¸ê®Æªí¤º¡G

½Æ»s¸ê®Æªí
  1. Create Table·s¸ê®Æªí¦W Select ¡¯ From ¤w¦s¦b¸ê®Æªí¦W
½Æ»s¥N½X
¨Ò¦p¡G¬°¡utranscript¡v¸ê®Æªí«Ø¥ß¤@­Ó³Æ¤À¸ê®Æªí¡utranscript_bak¡v¡G
ex09_07.php
  1. <?
  2.     $conn = mysql_connect("localhost", "root", "12345a");
  3.     if(mysql_select_db("STUDENTS", $conn))
  4.      {
  5.       //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
  6.       mysql_query("set character set big5");
  7.       //¸ê®Æ®w¦s¦b,«Ø¥ßSQL©R¥O¦r¦ê
  8.       $SQL="Create Table transcript_bak Select * From transcript";
  9.       //±N¦^¶Çµ²ªG¦s©ñ©óÅܼƤ¤
  10.       $datalist=mysql_query($SQL);
  11.      }
  12.     else
  13.      {
  14.       echo "¸ê®Æ®w¤£¦s¦b";
  15.      }
  16. ?>
½Æ»s¥N½X
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

¿z¿ï¸ê®Æ¨Ã¥t¦s©ó·s¸ê®Æªí
³o¬O³Ì±`¥Îªº¤@ºØCreate Select«ü¥O±Ô­z¡A´N¬Oª½±µ¿z¿ï¤w¦s¦bªº¸ê®Æªí¸ê®Æ¡AµM«á±N¿z¿ï«áªº¸ê®Æ¥t¥~«Ø¥ß¦¨¤@­Ó·sªº¸ê®Æªí¡G

·s¼W¸ê®Æªí
  1. Create Table·s¸ê®Æªí¦W Select ¡¯From ¸ê®Æªí Where ±ø¥ó¦¡
½Æ»s¥N½X
¨Ò¦p¡G¿z¿ï¡utranscript¡v¸ê®Æªí¤º°ê¤å¦¨ÁZ¤j©ó95¤Àªº¦P¾Ç¸ê®Æ¡A¦s¤J·s«Øªº¡ubigthen95¡v¸ê®Æªí¤º¡G
ex09_08.php
  1. <?
  2.     $conn = mysql_connect("localhost", "root", "12345a");
  3.     if(mysql_select_db("STUDENTS", $conn))
  4.      {
  5.       //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
  6.       mysql_query("set character set big5");
  7.       //¸ê®Æ®w¦s¦b,«Ø¥ßSQL©R¥O¦r¦ê
  8.       $SQL="Create Table bigthen95
  9. Select * From transcript where °ê¤å>95";
  10.       //±N¦^¶Çµ²ªG¦s©ñ©óÅܼƤ¤
  11.       $datalist=mysql_query($SQL);
  12.      }
  13.     else
  14.      {
  15.       echo "¸ê®Æ®w¤£¦s¦b";
  16.      }
  17. ?>
½Æ»s¥N½X

¹Ï9-19   ¥t¦s·s¸ê®Æªí¡A½d¨Òex09_08.php¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¨S¦³©Ò¦³Åv¡A¥u¦³¥Í©Rªº¨Ï¥ÎÅv¡C
ªð¦^¦Cªí ¤W¤@¥DÃD