SQLÓï·¨×ܽá
ÕâÊÇÎÒ±ßѧ±ß×ܽáµÄ£¬×ܹ²»¨ÁËÒ»ÌìÒ»Ò¹µÄʱ¼ä£¬²é×ÊÁϺͿ´ÊÓƵÍê³ÉµÄ£¬µ«ÎÒ¶Ôµ¥Ðк¯ÊýºÍ¶àÐк¯ÊýûÓÐ×ö¹ý¶àµÄÑо¿£¬ÒòΪÕß¿ÉÒÔ²éÎĵµ¡£»¹ÓоÍÊǶà±í²éѯÑо¿Ò²±È½Ïdz£¬Õâ¿ÉÒÔÔÚÒÔºóÓõ½µÄʱºòÔÚ¾ßÌåÑо¿¡£ »¹ÓоÍÊÇÒªÊìϤÊý¾Ý¿âµÄ²Ù×÷£¬Ôöɾ¸Ä²é£¬ÕâЩ¶¼ÒªÏ൱ÊìÁ·£¬Íü¼ÇʱҪ¼°Ê±¿´±Ê¼Ç¡£
SQL
1.......Êý¾ÝÀàÐÍ
char(10)£¨Õâ¸öÊÇÓÃÀ´´æ´¢Ö¸¶¨´æ´¢´óСµÄ×Ö·û¿ª±ÙµÄ¿Õ¼äΪ10£©,
varchar2(10)£¨Õâ¸öÊÇÓÃÀ´´æ´¢×Ö·û£¬¿ª±ÙµÄ¿Õ¼äΪ10µ±´æ´¢µÄ×Ö·û¿Õ¼ä²»µ½10ʱ¶àÓàµÄ¿Õ¼ä×Ô¶¯Êջأ¬ÖÐÎÄÕ¾Á½¸ö¿Õ¼ä£©,number(10)£¨ÓÃÀ´´æ´¢ÕûÊý£©,number(10,3)£¨ÓÃÀ´´æ´¢Ð¡Êý£¬Ò»¹²10λСÊýÕ¼Èý룩,date£¨ÓÃÀ´´æ´¢ÈÕÆÚ£©¡£
2.......´´½¨±í
Àý£º
create table fg_user
( name char(10),
age number(3),
salary number(7,2),
birthday date
);
fg_userÊDZíÃû£¨fgÊÇǰ׺£©¡£
3.......²éѯ±í
desc fg_userÊDzéѯ±íµÄ£¨¿´¿´´´½¨ÁËÄÇЩÀàÈÝÈ磺name£¬age£¬salary£¬birthdayµÈ£©¡£
4.......Ïò±íÖÐдÈëÊý¾Ý£ºinsert into fg_user values('·ë¿¡','19','-700',','11-7ÔÂ-1990');
µ±ÓеÄÊý¾Ý²»È·¶¨Ê±¿ÉÒÔÓúóÃæÁ½ÖÖд·¨ÖеÄÒ»ÖÖ£º
insert into fg_user values('·ë¿¡',19,-700,'11-7ÔÂ-1990');
insert into fg_user values('»ÆСÃ÷',31,null,null);
insert into fg_user(name,age) values('ÀîÁ¬½Ü',41);
commit;
5.......Ìá½»±í
дÍêºóÒªÌá½»£¬²»È»²»±£´æ¡£Ìá½»ÊÇcommit
6.......²éѯÌá½»µÄ±íÖеÄÊý¾Ý£¨ÏÞÖƵÄÊÇÁÐ È磺select salary£©
select * from fg_user;
selectµÄʹÓ÷½·¨£ºselect name||'µÄ¹¤×Ê'||salary from fg_user;
select name,salary from fg_user;
±ðÃûµÄʹÓ㺠select name,salary from fg_user;
select name||'µÄ¹¤×Ê'||salary sss from fg_user;µ±ÓиñʽÏÞÖÆʱ±ðÃû¼ÓË«ÒýºÅ"s ss"¡£
È¥Öظ´ÐÐdistinct£¨²»ÏÔʾÖظ´µÄ£©£º
select distinct name,age,salary from fg_user;
Ïà¹ØÎĵµ£º
1.´ò¿ªSQL server enterprise mananger “ÆóÒµ¹ÜÀíÆ÷”
ÔÚÄãÒªµ¼³öµÄSQLÊý¾Ý¿âÉÏÊó±êÓÒ¼ü²Ëµ¥£ºËùÓÐÈÎÎñ-¡·µ¼³öÊý¾Ý
2.»Ø³öÏÖÒ»¸öµ¼³öÏòµ¼´°¿Ú¡£
Ñ¡Ôñ±»µ¼³öµÄÊý¾ÝÔ´£¬ÎªÄã¸Õ²ÅËùÑ¡ÔñµÄÊý¾Ý¿â£¬Èç¹û·¢ÏÖ²»¶ÔÓ¦×ÔÐÐÐ޸ġ£
3.½øÈëµ¼³öµ½Ä¿±êÊý¾ÝÔ´µÄÑ¡Ôñ£¬ÕâÀïÎÒÃÇҪת³ÉACCESSµÄÊý¾Ý¿â¡£×¢ÒâÑ¡ÔñÊý¾ÝÔ´ÀàÐÍÎ ......
http://www.umgr.com/blog/PostView.aspx?bpId=36294
1. Ö´ÐÐsqlÓï¾ä
int sqlite3_exec(sqlite3*£¬ const char *sql£¬ sqlite3_callbacksql Óï·¨
£¬ void *£¬ char **errmsg );
Õâ¾ÍÊÇÖ´ÐÐÒ»Ìõ sql Óï¾äµÄº¯Êý¡£
µÚ1¸ö²ÎÊý²»ÔÙ˵ÁË£¬ÊÇÇ°Ãæopenº¯ÊýµÃµ½µÄÖ¸Õ롣˵ÁËÊǹؼüÊý¾Ý½á¹¹¡£
µÚ2¸ö²ÎÊýconst char ......
1.Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)¡¡¡¡
¡¡¡¡ SQLSERVERµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í£¬µ±SQLSERVER´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á ......
¹Û²ì½üÀ´µÄһЩ°²È«Ê¼þ¼°Æäºó¹û£¬°²È«×¨¼ÒÃÇÒѾµÃµ½Ò»¸ö½áÂÛ£¬ÕâЩÍþвÖ÷ÒªÊÇͨ¹ýSQL×¢ÈëÔì³ÉµÄ¡£ËäȻǰÃæÓÐÐí¶àÎÄÕÂÌÖÂÛÁËSQL×¢È룬µ«½ñÌìËùÌÖÂÛµÄÄÚÈÝÒ²Ðí¿É°ïÖúÄã¼ì²é×Ô¼ºµÄ·þÎñÆ÷£¬²¢²ÉÈ¡ÏàÓ¦·À·¶´ëÊ©¡£
SQL×¢Èë¹¥»÷µÄÖÖÀà
Öª±ËÖª¼º£¬·½¿Éȡʤ¡£Ê×ÏÈÒªÇå³þSQL×¢Èë¹¥»÷ÓÐÄÄЩÖÖÀà¡£
1.ûÓÐÕýÈ·¹ýÂËתÒå× ......