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;
Ïà¹ØÎĵµ£º
Sql´úÂë
--²ÉÓÃSQLÓï¾äʵÏÖsql2005ºÍExcel Êý¾ÝÖ®¼äµÄÊý¾Ýµ¼Èëµ¼³ö£¬ÔÚÍøÉÏÕÒÀ´Ò»--Ï£¬ÊµÏÖ·½·¨ÊÇÕâÑùµÄ£º
--Excel---->SQL2005 µ¼È룺
select * into useinfo from O ......
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 ......
Ò»£ºSQL Loader µÄÌصã
oracle×Ô¼º´øÁ˺ܶàµÄ¹¤¾ß¿ÉÒÔÓÃÀ´½øÐÐÊý¾ÝµÄǨÒÆ¡¢±¸·ÝºÍ»Ö¸´µÈ¹¤×÷¡£µ«ÊÇÿ¸ö¹¤¾ß¶¼ÓÐ×Ô¼ºµÄÌص㡣
±ÈÈç˵expºÍimp¿ÉÒÔ¶ÔÊý¾Ý¿âÖеÄÊý¾Ý½øÐе¼³öºÍµ¼³öµÄ¹¤×÷£¬ÊÇÒ»ÖֺܺõÄÊý¾Ý¿â±¸·ÝºÍ»Ö¸´µÄ¹¤¾ß£¬Òò´ËÖ÷ÒªÓÃÔÚÊý¾Ý¿âµÄÈȱ¸·ÝºÍ»Ö¸´·½Ãæ¡£ÓÐ×ÅËٶȿ죬ʹÓüòµ¥£¬¿ì½ÝµÄÓŵ㣻ͬʱҲÓÐһЩȱµ ......
¡¡¡¡1¡¢²é¿´±í¿Õ¼äµÄÃû³Æ¼°´óС
¡¡¡¡select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size
¡¡¡¡from dba_tablespaces t, dba_data_files d
¡¡¡¡where t.tablespace_name = d.tablespace_name
¡¡¡¡group by t.tablespace_name;
¡¡¡¡
¡¡¡¡2¡¢²é¿´±í¿Õ¼äÎïÀíÎļþµÄÃû³Æ¼°´óС
¡¡¡¡select tablesp ......
Êý¾Ý¶¨ÒåÓïÑÔ£¨DDL£©<²Ù×÷±íµÄ½á¹¹>£ºcreate£¨ ´´½¨£©¡¢
alter£¨¸ü¸Ä£©¡¢
drop£¨É¾³ý£©
Êý¾Ý²Ù×ÝÓïÑÔ£¨DML£©<²Ù×÷±íµÄÊý¾Ý>£ºinsert£¨²åÈ룩¡¢select£¨Ñ¡Ôñ£©¡¢delete£¨É¾³ý£©¡¢update£¨¸üУ©
ÊÂÎñ¿ØÖÆÓïÑÔ£¨TCL£©£ºcommit £¨ Ìá½»£©¡¢savepoint£¨±£´æµã£©¡¢rollback£¨»Ø¹ö£©
Êý¾Ý¿ØÖÆÓïÑÔ£ºgrant£¨ÊÚÓè£ ......