Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

£Ûת£ÝmysqlÐ޸ıí½á¹¹alter


 
£Ûת×Ô£Ýhttp://waryist.javaeye.com/blog/104739
ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...]
alter_specification:
        ADD [COLUMN] create_definition [FIRST | AFTER column_name ]
  or    ADD INDEX [index_name] (index_col_name,...)
  or    ADD PRIMARY KEY (index_col_name,...)
  or    ADD UNIQUE [index_name] (index_col_name,...)
  or    ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}
  or    CHANGE [COLUMN] old_col_name create_definition
  or    MODIFY [COLUMN] create_definition
  or    DROP [COLUMN] col_name
  or    DROP PRIMARY KEY
  or    DROP INDEX index_name
  or    RENAME [AS] new_tbl_name
  or    table_options
ALTER TABLEÔÊÐíÄãÐÞ¸ÄÒ»¸öÏÖÓбíµÄ½á¹¹¡£ÀýÈ磬Äã¿ÉÒÔÔö¼Ó»òɾ³ýÁС¢´´Ôì»òÏûÈ¥Ë÷Òý¡¢¸Ä±äÏÖÓÐÁеÄÀàÐÍ¡¢»òÖØÐÂÃüÃûÁлò±í±¾Éí¡£ÄãÒ²Äܸıä±íµÄ×¢ÊͺͱíµÄÀàÐÍ¡£¼û7.7 CREATE TABLE¾ä·¨¡£
Èç¹ûÄãʹÓÃALTER TABLEÐÞ¸ÄÒ»¸öÁÐ˵Ã÷µ«ÊÇDESCRIBE tbl_nameÏÔʾÄãµÄÁв¢Ã»Óб»Ð޸ģ¬Õâ¿ÉÄÜÊÇMySQL
ÒòΪÔÚ7.7.1 Òþº¬µÄÁÐ˵Ã÷¸Ä±äÖÐÃèÊöµÄÔ­ÒòÖ®Ò»¶øºöÂÔÁËÄãµÄÐ޸ġ£ÀýÈ磬Èç¹ûÄãÊÔͼ½«Ò»¸öVARCHAR¸ÄΪCHAR£¬MySQL
½«ÈÔȻʹÓÃVARCHAR£¬Èç¹û±í°ü º¬ÆäËû±ä³¤µÄÁС£
ALTER
TABLEͨ¹ýÖÆ×÷Ô­À´±íµÄÒ»¸öÁÙʱ¸±±¾À´¹¤×÷¡£ÐÞ¸ÄÔÚ¸±±¾ÉÏÊ©ÐУ¬È»ºóÔ­À´µÄ±í±»É¾³ý²¢ÇÒÖØÐÂÃüÃûÒ»¸öеġ£ÕâÑù×öʹµÃËùÓеÄÐÞ¸Ä×Ô¶¯µØתÏòµ½ÐÂ±í£¬Ã»
ÓÐÈκÎʧ°ÜµÄÐ޸ġ£µ±ALTER TABLEÕýÔÚÖ´ÐÐʱ£¬Ô­À´µÄ×À¿É±»ÆäËû¿Í»§¶ÁÈ¡¡£¸üкÍдÈë±í±»ÑÓ³Ùµ½Ð±í×¼±¸ºÃÁËΪֹ¡£
ΪÁËʹÓÃALTER TABLE£¬ÄãÐèÒªÔÚ±íÉϵÄselect¡¢insert¡¢delete¡¢update¡¢createºÍdropµÄȨÏÞ¡£
IGNOREÊÇMySQL
¶ÔANSI SQL92 µÄÒ»¸öÀ©³ä£¬Èç¹ûÔÚбíÖеÄΨһ¼üÉÏÓÐÖظ´£¬Ëü¿ØÖÆALTER TABLEÈçºÎ¹¤×÷¡£Èç¹ûIGNOREû±»Ö¸¶¨£¬¸±±¾±»·ÅÆú²¢ÇÒ»Ö¸´


Ïà¹ØÎĵµ£º

SQL ServerºÍMySQLÖÐTopÓ÷¨µÄÇø±ð

      ½ñÌìÁ·Ï°ÔÚJSPÒ³ÃæÖÐʵÏÖ·ÖҳЧ¹û£¬ÔÚ²éѯÓï¾ä·½ÃæÇ£³¶µ½ÁËtopµÄÓ÷¨¡£¼òÒª×öÒ»ÏÂ×ܽ᣺
      ΪʵÏÖÀàËÆtopµÄ¹¦ÄÜ£¬ÎÒÃÇÔÚSQL ServerÖкÍMySQLÖÐʹÓõ½µÄSQLÓï¾äÊDz»Í¬µÄ¡£
      1¡¢ÔÚSQL ServerÖУ¬ÎÒÃÇʹÓà select top N * ......

php mysql ²ÉÓà utf 8 µÄÅäÖÃ

1¡¢ÔÚÅäÖÃmysqlʵÀýµÄÓïÑÔÑ¡Ïîʱ£¬Ñ¡Ôñutf-8
2¡¢ÔÚhtml,phpÒ³ÃæÖÐ ¼ÓÉÏ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />£¬Èç¹û²»ÐÐÔÙÔÚ phpÎļþ Æðʼ´¦¼Ó header("Content-Type:text/html;charset=utf-8");
3¡¢ÔÚphpÖÐ×öÊý¾Ý¿âÁ¬½Óʱ£¬ÎÒÓõÄʱpdoµÄÐÎʽ£¬Ë ......

mysqlµÄsql_mode½éÉÜ

mysql¿ÉÒÔÔËÐÐÔÚ²»Í¬sql modeģʽÏÂÃ棬sql modeģʽ¶¨ÒåÁËmysqlÓ¦¸ÃÖ§³ÖµÄsqlÓï·¨£¬Êý¾ÝУÑéµÈ£¡
 
²é¿´Ä¬ÈϵÄsql modeģʽ£º
select @@sql_mode;
ÎÒµÄÊý¾Ý¿âÊÇ£º
STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
ÔÚ´ËģʽÏÂÃ棬Èç¹û²åÈëµÄÊý¾ÝµÄ³¤¶È´óÓÚ¶¨ÒåµÄ³¤¶È£¬ÄÇô¾Í»á±¨´í£¡
  ......

mysql³£ÓÃÃüÁî


1¡¢MySQL³£ÓÃÃüÁî
create database name; ´´½¨Êý¾Ý¿â
use databasename; Ñ¡ÔñÊý¾Ý¿â
drop database name Ö±½Óɾ³ýÊý¾Ý¿â£¬²»ÌáÐÑ
show tables; ÏÔʾ±í
describe tablename; ±íµÄÏêϸÃèÊö
select ÖмÓÉÏdistinctÈ¥³ýÖظ´×Ö¶Î
mysqladmin drop databasename ɾ³ýÊý¾Ý¿âÇ°£¬ÓÐÌáʾ¡£
ÏÔʾµ±Ç°mysql°æ±¾ºÍµ±Ç°ÈÕÆÚ
s ......

windows7Ï°²×°apache+php+mysqlÎÊÌâ¼Ç¼

×î½üÐÂÂòÁ˸öµçÄÔ£¬ÏµÍ³ÊÇwindows7£¬window7ÔÚ½çÃ棬¹¦ÄÜ·½Ã涼ͦÈÃÈËÂúÒâµÄ£¬¸Ð¾õºÜˬ£¬²»Ë¬µÄÊÇÓÖÒªÖØа²×°»·¾³ÁË¡£
ËùÓÐÈí¼þ¾ù°²×°ÔÚF:\server\ÏÂ
apacheĿ¼£ºF:\server\apache2.2
phpĿ¼£ºF:\server\php
msyqlĿ¼£ºF:\server\mysql
Ò»¡¢°²×°apache
°²×°apacheµÄ°æ±¾ÊÇ£ºhttpd-2.2.15-win32-x86-no_ssl.msi
° ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ