Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQLÓï¾ä¸´Ï°:insert,update,delete,select

 ×î½üÒ»Ö±ÔÚѧϰSQL serverµÄÄÚÈÝ¡£×òÌ쿼ÁËÒ»ÏÂÊÔ¡£¸Ð¾õÕæµÄÊDz»ÈÝÒ×°¡¡£ÌرðÊÇһЩ¸´ÔӵIJéѯ¡£¸ãµÃÎÒÍ·»èÄÔÕ͵ġ£²»¹ýÒ²ÊÇÓÉÓÚ×Ô¼ºµÄ֪ʶÕÆÎյĻ¹²»¹»Ôúʵ°¡¡£ËùÒÔ½ñÌ츴ϰÁËÒ»ÏÂT-SQlÓï¾äµÄÔöɾ¸Ä²é¡£·¢ÏÖµÄÈ·ÊÇÓкܶ඼Íü¼ÇÁË¡£ÏÖÔڰѽá¹ûд³öÀ´¡£ÒÔºó¿É²»ÒªÍüÁËѽ¡£
--SQLÓï¾ä¸´Ï° --Ò»,²åÈëinsertÓï¾ä --1,insertµ¥ÐÐÊý¾Ý insert into students(sName,sAddress,Ssex,Semail) values('ÐÕÃû','µØÖ·','ÐÔ±ð','ÓʼþµØÖ·')
--2,insert¶àÐÐÊý¾Ý£¬°ÑÆäËû±íÖÐÏÖÓеÄÊý¾Ý¾­¹ýÑ¡È¡ºó²åÈëµ½Êý¾Ý¿âÖÐ --°Ñ±íStudent¶ÔÓ¦µÄSname£¬Saddress£¬SemailÈýÁеÄÈ«²¿ÐУ¬ --²åÈëµ½TongXuLu±íÖеÄÐÕÃû£¬µØÖ·£¬µç×ÓÓʼþÈýÁÐÖÐ insert into students(ÐÕÃû,µØÖ·,µç×ÓÓʼþ) select Sname,Saddress,semail from students
--3,insert¶àÐÐÊý¾Ýµ½Ð½¨µÄ±íÖУ¬±í²»ÄÜÊÂÏÈ´æÔÚ --½«´´½¨TongXueLu±í£¬Í¬Ê±´´½¨Èý¸ö×Ö¶ÎSname£¬Saddress£¬Semail£¬ºÍ±êʶÁÐstudentID --²¢ÇÒ°ÑStudent±íÖеÄÕâÈýÁÐÊý¾ÝÏîÈ«²¿²åÈ뵽бíÖС£ select Students.Sname,Students.Saddress,Students.Semail,identity(int,1,1) as studentID--±êʶÁÐÁÐÃû into TongXuLu from Students
--4,ÊÖд¶àÐÐÊý¾Ýͨ¹ýUnionºÏ²¢²åÈë insert students(Sname,Sgrade,Ssex) select 'ÕÅ¿É',7,1 union select 'ÕÅÈý',4,0 union select '³Â¸Õ',4,1 union select 'Íõ¾ê¾ê',7,0
--¶þ£¬updateÊý¾Ý update students set Ssex=1,Sgrade=Sgrade+1 where Ssex=0
--Èý£¬delectÊý¾Ý --1,ɾ³ýÖ¸¶¨Êý¾Ý delete from students where Ssex=0
--2£¬É¾³ýËùÓÐÊý¾Ý --µÚÒ»ÖÖ·½·¨ delete from students --µÚ¶þÖÖ·½·¨,±ÈdeleteÖ´ÐÐËٶȿ죬ʹÓõÄϵͳ×ÊÔ´ºÍÊÂÎñÈÕÖ¾×ÊÔ´¸üÉÙ --µ«ÊDz»ÄÜÓÃÓÚÓÐÍâ¼üÔ¼ÊøµÄ±í truncate table students
--¸½¼Ó --1£¬°ÑËùÓÐÄÐͬѧµÄ³É¼¨¼Ó5·Ö update Sscore set score=score+5 where StudentID(select Scode from students where Ssex=1)
--2£¬Ö»¸´ÖÆStudentsµÄ±í½á¹¹£¬²»¸´ÖÆÊý¾Ý select identity(int 1,1) as InfoID,Sname,Saddress,Sgrade,Semail,Ssex into studnetInfo from students where (1<0)
--ËÄ£¬²éѯ --£¨Ò»£©Ò»°ãÊý¾Ý²éѯ --1£¬²éѯËùÓеÄÊý¾ÝÐкÍÁÐ select * from Students
--2,²éѯ²¿·ÖÊý¾ÝÐÐÁÐ --Ö»²éѯµØַΪ'ºÓÄÏÐÂÏç'µÄѧԱ£¬²¢ÇÒÖ»ÏÔʾ±àºÅ£¬ÐÕÃûºÍµØÖ·ÁÐ select Scode,Sname,Saddress from students where Saddress='ºÓÄÏÐÂÏç'
--3,²éѯÖÐʹÓÃÁÐÃû select scode as ѧÉú±àº


Ïà¹ØÎĵµ£º

ORACLE PL/SQL ¼¯ºÏѧϰ±Ê¼Ç(¶þ)

Èý¡¢Ç¶Ì×±íµÄʹÓ÷½·¨
 
1¡¢½«Ç¶Ì×±í¶¨ÒåΪPL/SQLµÄ³ÌÐò¹¹Ôì¿é
 
TYPE type_name IS TABLE OF element_type[NOT NULL];
 
ÈçÏÂÀýËùʾ£º
DECLARE

-- Define a nested table of variable length strings.
TYPE card_table IS TABLE OF VARCHAR2(5 CHAR);

-- Declare and initialize a n ......

ORACLE PL/SQL ¼¯ºÏAPI ×ܽá

ORACLE 10GµÄ¼¯ºÏAPI
 
¼¯ºÏAPI·½·¨×îÔçÊÇÔÚORACLE 8IÖÐÒýÈëµÄ¡£¼¯ºÏAPIÌṩÁ˼ò»¯·ÃÎʼ¯ºÏµÄ·½·¨¡£ÔÚORACLE 10GÒÔÇ°£¬ÕâЩ·½·¨È·Êµ¼ò»¯Á˶Լ¯ºÏµÄ·ÃÎÊ¡£µ«ÊÇ£¬²¢²»ÊÇ·ÇÒªÇóÕÆÎÕÕâЩ·½·¨²»¿É¡£´ÓORACLE 9IµÄINDEX-BY±íµ½ORACLE 10GµÄÁªºÏÊý×éµÄת»»£¬Ê¹ËüÃdzÉΪ±ØÐëÕÆÎյķ½·¨¡£
 
ÏÂÃæÊÇÎÒ´ÓÊéÉÏժ¼ÏµÄһР......

SQL²Ù×÷È«¼¯

ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE data ......

sql´óÈ«³¬Ïêϸ

  SQL ÃüÁî
Õⲿ·Ö°üº¬ÄÇЩ PostgreSQL Ö§³ÖµÄ SQL ÃüÁîµÄÐÅÏ¢£®ÕâÀïµÄ "SQL" ¾ÍÊǸÃÓïÑÔͨ³£µÄº¬Ò壻 ÿÌõÃüÁîµÄÓë±ê×¼ÓйصļæÈÝÐÔµÄÐÅÏ¢¿ÉÒÔÔÚÏà¹ØµÄ²Î¿¼Ò³ÖÐÕÒµ½£®
Table of Contents
ABORT --  Í˳öµ±Ç°ÊÂÎñ
ALTER GROUP --  Ïò×éÖÐÔö¼ÓÓû§»ò´Ó×éÖÐɾ³ýÓû§ 
ALTER USER --  ¸Ä±äÊý¾ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ