¾µä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
º¯ÊýµÄѧϰ
µ¥Ðк¯Êý ·µ»ØÖµÖ»ÓÐÒ»¸ö
·Ö×é
Ïà¹ØÎĵµ£º
import java.sql.*;
/*
* JAVAÁ¬½ÓACCESS£¬SQL Server,MySQL,OracleÊý¾Ý¿â
*
* */
public class JDBC {
public static void main(String[] args)throws Exception {
Connection conn=null;
//====Á¬½ÓACCESSÊý¾Ý¿â ......
ÏëÆðÀ´ÉÏ´ÎÃæÊÔµÄʱºòÄǸöÃæÊÔ¹ÙÎÊÎÒ
“Äã¶ÔÓÅ»¯·½ÃæÁ˽â¶àÉÙ”
“ORACLEÓÅ»¯»¹ÊÇSQLÓÅ»¯”
“SQLÓÅ»¯”
“Õâ¸ö……²»ÖªµÀ´ÓºÎ˵Æð”
“ºÇºÇ£¬ÄÇÎÒÎÊÄãÎÊÌâºÃÁË£¬ÎÊÎʾÍÖªµÀÄã´ó¸ÅʲôˮƽÁË”
“ºÇºÇ£¬ºÃ°É”
……
½á¹ûºÃÏñ ......
SQL Server
2000¶©ÔÄÓë·¢²¼µÄ¾ßÌå²Ù×÷
ͬ²½¹ý³Ì
¡¡¡¡Ò»¡¢×¼±¸¹¤×÷£¬Èç¹ûÍê³ÉÔò¿ÉÌø¹ý¡£
¡¡¡¡1¡¢ÄÚÍøDB·þÎñÆ÷×÷Ϊ·¢²¼·þÎñÆ÷£¬ÍâÍøDB·þÎñÆ÷×÷Ϊ¶©ÔÄ·þÎñÆ÷¡£
¡¡¡¡·¢²¼·þÎñÆ÷ºÍ¶©ÔÄ·þÎñÆ÷ÉϷֱ𴴽¨WindowsÓû§jl,ÃÜÂëjl£¬Á¥ÊôÓÚadministrators£¬×¢ÒâÒª±£³ÖÒ»Ö¡£
¡¡¡¡2¡¢·¢²¼·þÎñÆ÷ÉÏ´´½¨Ò»¸ö¹²ÏíĿ¼£¬×÷Ϊ·¢²¼¿ìÕÕÎ ......
ÒÔÏÂʵÏÖ¸´ÖƲ½Ö裨ÒÔ¿ìÕÕ¸´ÖÆΪÀý£©
ÔËÐÐƽ̨SQL SERVER 2005
Ò»¡¢×¼±¸¹¤×÷£º
1£®½¨Á¢Ò»¸ö WINDOWS Óû§£¬ÉèÖÃΪ¹ÜÀíԱȨÏÞ£¬²¢ÉèÖÃÃÜÂ룬×÷Ϊ·¢²¼¿ìÕÕÎļþµÄÓÐЧ·ÃÎÊÓû§¡£
2£®ÔÚSQL SERVERÏÂʵÏÖ·¢²¼·þÎñÆ÷ºÍ¶©ÔÄ·þÎñÆ÷µÄͨÐÅÕý³££¨¼´¿ÉÒÔ»¥·Ã£©¡£´ò¿ª1433¶Ë¿Ú£¬ÔÚ·À»ðǽÖÐÉèÌØÀý
3£®ÔÚ·¢²¼·þÎñÆ÷ÉϽ¨Á¢Ò»¸ö ......