Oracle¶¨ÒåÔ¼Êø Íâ¼üÔ¼Êø
Íâ¼üÔ¼Êø±£Ö¤²ÎÕÕÍêÕûÐÔ¡£Íâ¼üÔ¼ÊøÏÞ¶¨ÁËÒ»¸öÁеÄÈ¡Öµ·¶Î§¡£Ò»¸öÀý×Ó¾ÍÊÇÏÞ¶¨ÖÝÃûËõдÔÚÒ»¸öÓÐÏÞÖµ¼¯ºÏÖУ¬Õâ¸öÖµ¼¯ºÏÊÇÁíÍâÒ»¸ö¿ØÖƽṹ——Ò»ÕŸ¸±í
ÏÂÃæÎÒÃÇ´´½¨Ò»ÕŲÎÕÕ±í£¬ËüÌṩÁËÍêÕûµÄÖÝËõдÁÐ±í£¬È»ºóʹÓòÎÕÕÍêÕûÐÔÈ·±£Ñ§ÉúÃÇÓÐÕýÈ·µÄÖÝËõд¡£µÚÒ»ÕűíÊÇÖݲÎÕÕ±í£¬State×÷ΪÖ÷¼ü
CREATE TABLE state_lookup
(state VARCHAR2(2),
state_desc VARCHAR2(30)) TABLESPACE student_data;
ALTER TABLE state_lookup
ADD CONSTRAINT pk_state_lookup PRIMARY KEY (state)
USING INDEX TABLESPACE student_index;
È»ºó²åÈ뼸ÐмǼ£º
INSERT INTO state_lookup VALUES ('CA', 'California');
INSERT INTO state_lookup VALUES ('NY', 'New York');
INSERT INTO state_lookup VALUES ('NC', 'North Carolina');
ÎÒÃÇͨ¹ýʵÏÖ¸¸×Ó¹ØϵÀ´±£Ö¤²ÎÕÕÍêÕûÐÔ£¬Í¼Ê¾ÈçÏÂ
--------------- Íâ¼ü×ֶδæÔÚÓÚStudents±íÖÐ
|State_lookup | ÊÇState×Ö¶Î
--------------- Ò»¸öÍâ¼ü±ØÐë²ÎÕÕÖ÷¼ü»òUnique×Ö¶Î
| Õâ¸öÀý×ÓÖУ¬ÎÒÃDzÎÕÕµÄÊÇState×Ö¶Î
| ËüÊÇÒ»¸öÖ÷¼ü×ֶΣ¨²Î¿´DDL£©
/|\
---------------
| Students |
---------------
ÉÏͼÏÔʾÁËState_Lookup±íºÍStudents±í¼äÒ»¶Ô¶àµÄ¹Øϵ£¬State_Lookup±í¶¨ÒåÁËÖÝËõдͨÓü¯ºÏ——ÔÚ±íÖÐÿһ¸öÖݳöÏÖÒ»´Î¡£Òò´Ë£¬State_Lookup±íµÄÖ÷¼üÊÇState×ֶΡ£
State_Lookup±íÖеÄÒ»¸öÖÝÃû¿ÉÒÔÔÚStudents±íÖгöÏÖ¶à´Î¡£ÓÐÐí¶àѧÉúÀ´×Ôͬһ¸öÖÝ£¬Ò»´Î£¬ÔÚ±íState_LookupºÍStudentsÖ®¼ä²ÎÕÕÍêÕûÐÔʵÏÖÁËÒ»¶Ô¶àµÄ¹Øϵ¡£
Íâ¼üͬʱ±£Ö¤Students±íÖÐState×ֶεÄÍêÕûÐÔ¡£Ã¿Ò»¸öѧÉú×ÜÊÇÓиöState_lookup±íÖгÉÔ±µÄÖÝËõд¡£
Íâ¼üÔ¼Êø´´½¨ÔÚ×Ó±í¡£ÏÂÃæÔÚstudents±íÉÏ´´½¨Ò»¸öÍâ¼üÔ¼Êø¡£State×ֶβÎÕÕstate_lookup±íµÄÖ÷¼ü¡£
1¡¢´´½¨±í
CREATE TABLE students
(student_id&n
Ïà¹ØÎĵµ£º
Ò» Oracle¹«Ë¾¼ò½é
OracleÊÇÒóÐæ³öÍÁµÄ¼×¹ÇÎÄ(oracle bone inscriptions)µÄÓ¢ÎÄ·ÒëµÄµÚÒ»¸öµ¥´Ê
Oracle¹«Ë¾ÊÇÈ«Çò×î´óµÄÐÅÏ¢¹ÜÀíÈí¼þ¼°·þÎñ¹©Ó¦ÉÌ£¬³ÉÁ¢ÓÚ1977Ä꣬×ܲ¿Î»ÓÚÃÀ¹ú¼ÓÖÝ Redwood shore
Oracle¹«Ë¾ÒòÆ临ÔӵĹØϵÊý¾Ý¿â²úÆ·¶øÎÅÃû¡£OracleµÄ¹ØϵÊý¾Ý¿âÊÇÊÀ½çµÚÒ»¸öÖ§³ÖSQLÓïÑÔµÄÊý¾Ý¿â
OracleÔÚ³¬¹ý ......
ÖйúµçÁ¦ÐÐҵĿǰÕýÔÚ¾Àúמ޴óµÄ±ä»¯£º´Ó¹ú¼Ò°ìµçµ½ÆóÒµ°ìµç£¬ÐγÉÁ˶à¼Ò¾ºÕù°ìµçµÄ¸ñ¾Ö£»³§Íø·Ö¿ª¡¢¾º¼ÛÉÏÍø£¬´Ó¼Æ»®µ½Êг¡×ª¹ì£¬ÒýÈë¶àÖÖ¾¼Ã³É·Ö£»´ÓµØÓòÐÔ·ÖÉ¢¹©µçÏò´óµçÍø·¢Õ¹£»´ÓÕþÆó²»·Öµ½ÕþÆó·Ö¿ª¡£ÕâЩ±ä»¯£¬Ê¹ÖйúµÄµçÁ¦ÐÐÒµ¾ÊÜ×ÅÇ°ËùδÓеÄѹÁ¦¡£
Ò»·½Ã棬2003Äê¹úÄڵķ¢µçÆóÒµÖØиÄ×é£ ......
oracle³£ÓÃÊý¾ÝÀàÐÍ
½ñÌìͬÊÂÎÊЩÊý¾ÝÀàÐ͵ÄÎÊÌ⣬ÓеĻ¹ÕæÓеã¼Ç²»ÇåÁË£¬ÓÚÊǾͼòµ¥×ܽáϳ£ÓõÄÊý¾ÝÀàÐÍÒÔ±¸ÈÕºó²éÓÃ
1¡¢Char
¶¨³¤¸ñʽ×Ö·û´®£¬ÔÚÊý¾Ý¿âÖд洢ʱ²»×ãλÊýÌî²¹¿Õ¸ñ£¬ËüµÄÉùÃ÷·½Ê½ÈçÏÂCHAR(L)£¬LΪ×Ö·û´®³¤¶È£¬
ȱʡΪ1£¬×÷Ϊ±äÁ¿×î´ó32767¸ö×Ö·û£¬×÷ΪÊý¾Ý´æ´¢ÔÚORACLE8ÖÐ×î´óΪ2000¡£²»½¨ÒéʹÓ㬻ᴠ......
Oracle Connect ByÓ÷¨
oracleÖеÄselectÓï¾ä¿ÉÒÔÓÃSTART WITH...CONNECT BY PRIOR×Ó¾äʵÏֵݹé²éѯ£¬connect by Êǽṹ»¯²éѯÖÐÓõ½µÄ£¬Æä»ù±¾Óï·¨ÊÇ£º
select ... from <TableName>
where <Conditional-1>
start with <Conditional-2>
connect by <Conditional-3>
;
<Conditi ......
1.sqlplus-----¿ªÆô·þÎñ
2.ÊäÈëÓû§ÃûºÍÃÜÂ루ĬÈÏ3¸öÓû§,×¢Ò⣬ÃÜÂëÊÇ¿ÉÒÔÐ޸ĵģºsystem/manager;scott/tiger;sys/change_on_install£©£¬Á¬½ÓÊý¿â¡£
3.´´½¨±í¿Õ¼ä£º
create tablespace ±í¿Õ¼äÂß¼Ãû datafile '±í¿Õ¼äÎļþµÄÎïÀíÂß¼'
size Îļþ´óС£¨È磺10m£© autoextend ÊÇ·ñ×Ô¶¯Ôö³¤Îļþ´óС£¨on/off ......