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

´«ÖDz¥¿Í—SQLÈëÃÅ

½ñÌì¿ÉÒÔ»»»»ÄÔ×ÓÁË£¬¶ªµôeclipse£¬ÍæÍæsqlÁË£¬ËäȻֻÊÇÔÚÃüÁîÐд°¿Ú
ÏÈ˵һϽñÌìÎÒÓöµ½µÄÎÊÌâ°É£¬¿ªÊ¼°´ÕÕÀÏʦµÄ²¿Êð£¬×öµÄ¶¼ºÜ˳Àû£¬µ«Êǵ±½¨Á¢ºÃÊý¾Ý¿âÖ®ºó£¬½¨Á¢±í½á¹¹µÄʱºò¾Í³ö´íÁË£¬Ô­ÒòÊÇÔÚÅäÖÃmysqlµÄʱºò£¬È¨ÏÞÅäÖôíÁË£¬ËùÒÔ˵ǧÀïÖ®µÌ»ÙÓÚÒÏѨ£¬º¦µÄÎÒÕûÁËÒ»¸öÖÐÎ磬ÕâʱÌáʾµÄ´íÎóÊÇERROR 1005: Can't create table (errno: 121)£¬³öÏÖÕâ¸ö´íÎó»¹ÓÐÒ»ÖÖ¿ÉÄܾÍÊÇÍâ¹Ø¼ü×ÖÃû×ÖÖØ¸´µÄ´íÎ󣬼´Ê¹ÊÇÔÚ²»Í¬µÄ±íÖУ¬Íâ¹Ø¼ü×ÖµÄÃû×ÖÒ²²»ÄÜÖØ¸´¡£
»¹ÓÐÒ»ÖÖ´íÎóÌáʾµÄÊÇ150µÄ´íÎó£¬ÕâÀà´íÎó°üÀ¨3ÖÖÇé¿ö£º
1. Íâ¼üºÍ±»ÒýÓÃÍâ¼üÀàÐͲ»Ò»Ñù£¬±ÈÈçintegerºÍdouble
2. ÕÒ²»µ½Òª±»ÒýÓõÄÁÐ
3. ±íµÄ×Ö·û±àÂë²»Ò»Ñù
¹þ¹þ£¬°ÑËùÓеĴíÎ󾡿ÉÄܵÄÈÃËû±©Â¶³öÀ´
µ±Äã°ÑÊý¾Ý¿â¶¼ÅäÖúÃÁËÖ®ºó£¬½øÈëÃüÁîÐд°¿Ú£¬ÊäÈëmysql -u  root -p Õâʱ»áÌáʾÄãÊäÈëpassword£¬ÎÒÉèÖõÄÊÇroot£¬È»ºóÊäÈëshow databases;Èç¹û³öÏÖdatabaseµÄĿ¼¾Í¶ÔÁË£¬×¢ÒâÕâÀïÒªÊäÈë“;”Ò»°ãÇé¿öÏ£¬ËüÖ»ÓÐÅöµ½·ÖºÅ²Å»áÖ´ÐÐÄãÊäÈëµÄÓï¾ä¡£
ºÜ¶àÈË·Ö²»ÇåÊý¾Ý¿â·þÎñÆ÷¡¢Êý¾Ý¿âºÍ±íµÄ¹ØÏµ£¬ÏÖÔھͼòÊöһϣº
Ò»¸öÊý¾Ý¿â·þÎñÆ÷¿ÉÒÔ¹ÜÀí¶à¸öÊý¾Ý¿â£¬Ò»°ãÒ»¸öÓ¦ÓóÌÐò¶ÔÓ¦ÓÚÒ»¸öÊý¾Ý¿â£»
Ò»¸öÊý¾Ý¿â¿ÉÒÔ¹ÜÀí¶à¸ö±í£¬Ã¿¸ö±íÒ»°ã¶ÔÓ¦ÓÚÒ»¸öʵÌ壻
±íΪÊý¾ÝµÄʵ¼Ê´æ´¢Î»Öá£
ÓÉÓÚÒÔºó»áƵ·±µÄ¸úÊý¾Ý¿â´ò½»µÀ£¬ËùÒÔ¶ÔÊý¾Ý¿âµÄÔöɾ¸Ä²é»¹ÊǺÜÖØÒªµÄ£¬ÊÚÈËÒÔÓã²»ÈçÊÚÈËÒÔÓæ£¬ÏÂÃæ¾Í˵һÏÂËüÃǵÄÉùÃ÷
²éѯ±íÖÐÐÅÏ¢
SELECT [DISTINCT] *|{column1, column2. column3..} from table;
Ïò±íÖвåÈëÐÅÏ¢
INSERT INTO table [(column [, column...])] VALUES (value [, value...]);
updateÓï¾ä
UPDATE  tbl_name SET col_name1=expr1 [, col_name2=expr2 ...] [WHERE where_definition] ;
ɾ³ýÓï¾ä
delete from tbl_name [WHERE where_definition];
ÕâÀïҪעÒâÒ»¸öÎÊÌ⣨²îµãÍü¼ÇÁË£¬ÔÚÉèÖÃ×Ö·û¼¯µÄʱºò£¬±ÈÈçÊÇUTF-8£¬ÔÚÉèÖõÄʱºòÊÇûÓГ-”µÄ£©£º
ÏÂÃæ¾Í¾Ù¸öµÄÀý×Ó°É£º
//´´½¨Ò»¸öÊý¾Ý¿â
create database mydb character set utf8 collate utf8_general_ci;
show databases;
use mydb;
//´´½¨Ò»¸ö±í½á¹¹
create table employee
(
 id int,
 name varchar(40),
 sex varchar(10),
 birthday date,
 entry_date date,
 job varchar(100),
 salary double,
 resume text
)character set utf


Ïà¹ØÎĵµ£º

ASP.NETÁ¬½ÓSQLºÍACCESSµÄ·½·¨

SQL:
using System.Data.SqlClient;
string sql = "server=.;uid=sa;pwd=;database=tablename;";
ACCESS:
using System.Data.OleDb;
string sql = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + HttpRuntime.AppDomainAppPath + "//App_Data//db.mdb";
HttpRuntime.AppDomainAppPath Ϊ¸ùĿ¼
......

sql²éÕÒÖØ¸´Êý¾Ý

1.²éÕÒÖØ¸´Êý¾Ý±íµÄidÒÔ¼°Öظ´Êý¾ÝµÄÌõÊý
select max(id) as nid,count(id) as ÖØ¸´ÌõÊý from tableName
group by linkname Having Count(*) > 1
2.²éÕÒÖØ¸´Êý¾Ý±íµÄÖ÷¼ü
select max(id) as nid from tableName
group by linkname  Having Count(id) > 1
3.ɾ³ýÖØ¸´µÄÊý¾Ý
delete from table ......

ÆÆ½âSQL Prompt 3.9µÄ¼¸²½²Ù×÷


¹ØÓÚSQL Prompt
µÄÆÆ½âÎÄÕÂÔ°×ÓÀïÒѾ­Óв»ÉÙÈË·¢¹ýÁË¡£ÆÆ½â˼·ÎÒÒ²²»ÏëÖØ¸´£¬²»ÖªµÀµÄ¿ÉÒԲο¼£ºhttp://www.cnblogs.com/jintan/archive/2008/06/16/1223282.html
¹Ù·½ÏÂÔØµØÖ·ÊÇ£ºhttp://downloads.red-gate.com/SQLToolbelt.exe
½ÓÏÂÀ´ÎÒ¾Í˵˵¾ßÌåÔõô×ö°É¡£ÎÒ¾Í˵˵×î¼òµ¥×îɵ¹ÏµÄ×ö·¨£¬²»ÐèÒª¶®ILÕÕÑùÆÆ½â£¡
× ......

Á¬½Óms sqlÊý¾Ý¿âд·¨

windows ¼¯³ÉÑéÖ¤£º
<connectionStrings>
   <add name="ConnectionStr" connectionString="Data Source=CAIPENG-PC;database=Test;Integrated Security=SSPI" providerName="System.Data.SqlClient"/>
  </connectionStrings>
»òÕß
<connectionStrings>
<add name=" ......

±¨±ísqlÐĵÃһƪ

×î½üºÜ棬ÓиöÏîÄ¿ÂíÉÏÒªÕб꣬һ¸öÏîÄ¿µÈ׏¤£¬Èô¸ÉËöËéµÄʽøÐÐÖУ¬ÓÐÒ»¶Îʱ¼äû¸üÐÂЩÓÐÓªÑøµÄ¶«Î÷ÁË
˵¸öÌâÍâ»°ÏÈ¡£
½ñÌ쿪»ú×¼±¸°Ñ×òÌìµÄ¶«Î÷debugһϣ¬ºÜϰ¹ßµØÓÒ¼üÏîÄ¿µÄÆô¶¯Îļþ¿ªÊ¼debug£¬»úÆ÷ͻȻÀ¶ÆÁÖØÆô¡£¿ªÊ¼ÒÔΪÓÖÊÇÄÚ´æÔÚ͵͵³¬Æµ£¬¼ì²éÁËÒ»ÏÂbios£¬·¢ÏÖûʲôÎÊÌ⣬ҲûÔõôÔÚÒ⣬ËíÖØÐ¿ªÆôvs2008¼ÌÐø ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ