¾µäSQL£¨2£©
1¡¢¾µäµÄ²éѯÓï¾ä
2¡¢¾µäµÄ×Ö¶¨Ò庯Êý
3¡¢¾µäµÄÓëÒµÎñÏà¹ØµÄ´æ´¢¹ý³Ì
µÈµÈ
1¡¢ ¸ú×Ùµ±Ç°¶Ô»°ÏÂÓû§µÄSQL½Å±¾
select sql_text from v$sqltext_with_newlines where (hash_value,address)
in (select sql_hash_value,sql_address from v$session where sid=&sid)
order by address,piece;
SID
ÓÉÕâµÃµ½
select sid,machine from v$session;
======
desc table;¼ì²é±í½á¹¹
select * from tab where tabtype='TABLE';ÏÔʾµ±Ç°Óû§ÏµÄËùÓÐ±í¡£
select count(*) from table;ÏÔʾ´Ë±íµÄÊý¾ÝÐÐÊý£»
spool c:\tony.txt;ÈռǷ¾¶
spool off;¹Ø±Õ¼Ç¼ºó¿ÉÒÔ¿´µ½ÈÕ¼ÇÎļþÀïµÄÄÚÈÝ¡£
alter table stu add(classid number(2));Ìí¼Ó×Ö¶Î
alter table stu modify(xm varchar2(12));ÐÞ¸Ä×ֶεij¤¶È
alter table stu drop column sal;
drop table stu;
rename student to stu;
alter table student drop column sal; alter table stu add(salary number(7,2));
insert into stu values('A001','ÕÅÈý','ÄÐ','01-5ÔÂ-05',10);
insert into stu(xh,xm,sex) values ('A003','JOHN','Å®');
insert into student(xh,xm,sex,birthday) values ('A004','MARTIN','ÄÐ',null);
ÐÞ¸Ä
update
update stu set sex='Å®' where xh='A001';
update student set sex='ÄÐ'£¬birthday='1980-04-01'where xh='A001';
update student set classid=20 where birthday is null;
delete from stu;drop table student;delete from stu where xh='A001';
truncate table stu;ɾ³ý±íÖеÄËùÓмǼ£¬±í½á¹¹»¹ÔÚ²»Ð´ÈÕ¼ÇÎÞ·¨ÕһؼǼ
select * from stu;
select * from student where classid like '1%';
select * from student where xh like '%A%';
select * from student where xh like 'A%';
select * from student where xh like '%A';
select * from student where xh = 'A%';
select * from student order by birthday;
select * from student order by birthday desc,xh asc; --°´birthday ½µÐò °´xhÉýÐò(asc/ĬÈÏ)
select * from student where sex='Å®' or birthday='1999-02-01';
select * from student where sex='Å®' and birthday='1999-02-01';
select * from student where salary > 20 and xh <> 'B002'; (!=)
oracle
º¯ÊýµÄѧϰ
µ¥Ðк¯Êý ·µ»ØÖµÖ»ÓÐÒ»¸ö
·Ö×é
Ïà¹ØÎĵµ£º
Ò»¡¢SQL SERVER ºÍACCESSµÄÊý¾Ýµ¼Èëµ¼³ö
³£¹æµÄÊý¾Ýµ¼Èëµ¼³ö£º
ʹÓÃDTSÏòµ¼Ç¨ÒÆÄãµÄAccessÊý¾Ýµ½SQL Server£¬Äã¿ÉÒÔʹÓÃÕâЩ²½Öè:
¡¡¡¡¡ð1ÔÚSQL SERVERÆóÒµ¹ÜÀíÆ÷ÖеÄTools£¨¹¤¾ß£©²Ëµ¥ÉÏ£¬Ñ¡ÔñData Transformation
¡¡¡¡¡ð2Services£¨Êý¾Ýת»»·þÎñ£©£¬È»ºóÑ¡Ôñ czdImport Dat ......
1.´ò¿ªSQL server enterprise mananger “ÆóÒµ¹ÜÀíÆ÷”
ÔÚÄãÒªµ¼³öµÄSQLÊý¾Ý¿âÉÏÊó±êÓÒ¼ü²Ëµ¥£ºËùÓÐÈÎÎñ-¡·µ¼³öÊý¾Ý
2.»Ø³öÏÖÒ»¸öµ¼³öÏòµ¼´°¿Ú¡£
Ñ¡Ôñ±»µ¼³öµÄÊý¾ÝÔ´£¬ÎªÄã¸Õ²ÅËùÑ¡ÔñµÄÊý¾Ý¿â£¬Èç¹û·¢ÏÖ²»¶ÔÓ¦×ÔÐÐÐ޸ġ£
3.½øÈëµ¼³öµ½Ä¿±êÊý¾ÝÔ´µÄÑ¡Ôñ£¬ÕâÀïÎÒÃÇҪת³ÉACCESSµÄÊý¾Ý¿â¡£×¢ÒâÑ¡ÔñÊý¾ÝÔ´ÀàÐÍÎ ......
--ÐÐÁл¥×ª
/******************************************************************************************************************************************************
ÒÔѧÉú³É¼¨ÎªÀý×Ó£¬±È½ÏÐÎÏóÒ׶®
ÕûÀíÈË£ºÖйú·ç(Roy)
ÈÕÆÚ:2008.06.06
***************************************************************** ......
ÏëÆðÀ´ÉÏ´ÎÃæÊÔµÄʱºòÄǸöÃæÊÔ¹ÙÎÊÎÒ
“Äã¶ÔÓÅ»¯·½ÃæÁ˽â¶àÉÙ”
“ORACLEÓÅ»¯»¹ÊÇSQLÓÅ»¯”
“SQLÓÅ»¯”
“Õâ¸ö……²»ÖªµÀ´ÓºÎ˵Æð”
“ºÇºÇ£¬ÄÇÎÒÎÊÄãÎÊÌâºÃÁË£¬ÎÊÎʾÍÖªµÀÄã´ó¸ÅʲôˮƽÁË”
“ºÇºÇ£¬ºÃ°É”
……
½á¹ûºÃÏñ ......
OracleµÄsql*plusÊÇÓëoracle½øÐн»»¥µÄ¿Í»§¶Ë¹¤¾ß¡£ÔÚsql*plusÖУ¬¿ÉÒÔÔËÐÐsql*plusÃüÁîÓësql*plusÓï¾ä¡£
ÎÒÃÇͨ³£Ëù˵µÄDML¡¢DDL¡¢DCLÓï¾ä¶¼ÊÇsql*plusÓï¾ä£¬ËüÃÇÖ´ÐÐÍêºó£¬¶¼¿ÉÒÔ±£´æÔÚÒ»¸ö±»³ÆΪsql bufferµÄÄÚ´æÇøÓòÖУ¬²¢ÇÒÖ»Äܱ£´æÒ»Ìõ×î½üÖ´ÐеÄsqlÓï¾ä£¬ÎÒÃÇ¿ÉÒÔ¶Ô±£´æÔÚsql bufferÖеÄsql Óï¾ä½øÐÐÐ޸ģ¬È» ......