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

sqlÓï¾ä»ù´¡

--------------------------------------------------------
--sql structured query language
--DML--Data Manipulation Language--Êý¾Ý²Ù×÷ÓïÑÔ
query information (SELECT),
add new rows (INSERT),
modify existing rows (UPDATE),
delete existing rows (DELETE),
perform a conditional update or insert operation (MERGE),
see an execution plan of SQL (EXPLAIN PLAN),
and lock a table to restrict access (LOCK TABLE).
--DDL--Data Definition Language--Êý¾Ý¶¨ÒåÓïÑÔ
create, modify,drop, or rename objects (CREATE,ALTER,DROP,RENAME),
remove all rows from a database object without dropping the structure (TRUNCATE),
manage access privileges (GRANT,REVOKE),
audit database use (AUDIT,NOAUDIT)
and add a description about an object to the dictionary (COMMENT).
--Transaction ControlÊÂÎñ¿ØÖÆÓï¾ä
save the changes(COMMIT)
or discard the changes (ROLLBACK) made by DML statements.
Also included in the transaction-control statements are statements to set a point or marker in the transaction for possible rollback (SAVEPOINT)
and to define the properties for the transaction (SET TRANSACTION).
Used to manage the properties of the database.
There isonly one statement in this category (ALTER SYSTEM).
--DCL--Data Control Language--Ó뿪·¢¹ØÏµ²»ÊǺÜÃÜÇÐ,ÓÃÓÚȨÏ޵ķÖÅäÓë»ØÊÕ
grant,revoke,data control
--Session Control
control the session properties (ALTER SESSION)
and to enable/disable roles (SET ROLE).
--System Control
--------------------------------------------------------
selectµÄÓ÷¨
--ÿ¸öÔ±¹¤µÄËùÓÐÐÅÏ¢
select * from emp
--ÿ¸öÈ˵IJ¿ÃűàºÅ£¬ÐÕÃû£¬Ð½Ë®
select deptno,ename,sal from emp;
--ÿ¸öÈ˵ÄÄêн
select ename,sal*12 from emp;
--¼ÆËã2*3µÄÖµ
select 2*3 from emp;
--¼ÆËã2*3µÄÖµ(dual)
select 2*3 from dual;
select * from dual;
--µÃµ½µ±Ç°Ê±¼ä
select sysdate from dual
--¿ÉÒÔ¸øÁÐÆð±ðÃû,±ÈÈçÇóÿ¸öÈ˵ÄÄêн
select ename,sal*12  salperyear from emp;
--Èç¹û±ðÃûÖÐÓпոñ£¬ÐèÒªÓÃË«ÒýºÅ
select ename,sal*12  "sal per y


Ïà¹ØÎĵµ£º

JSPʵÀýÈý¡¢sql·ÖÒ³(1)

index.jsp
<%@ page language="java" import="java.sql.*" import="java.lang.*" import="java.util.*" pageEncoding="GB2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%!
& ......

MySQL ×Ö·û¼¯µ¼ÖÂSQLÁ¬½ÓÖ®ºóÖÐÎÄÂÒÂëµÄÎÊÌ⣡

character-set-server = GB2312
collation-server = latin1_general_ci
MySQL×Ö·û¼¯ GBK¡¢GB2312¡¢UTF8Çø±ð ½â¾ö MYSQLÖÐÎÄÂÒÂëÎÊÌâ ÊÕ²Ø
MySQLÖÐÉæ¼°µÄ¼¸¸ö×Ö·û¼¯
character-set-server/default-character-set£º·þÎñÆ÷×Ö·û¼¯£¬Ä¬ÈÏÇé¿öÏÂËù²ÉÓõġ£
character-set-database£ºÊý¾Ý¿â×Ö·û¼¯¡£
character-set-table£ºÊ ......

ʹÓÃSQLServerÄ£°åÀ´Ð´¹æ·¶µÄSQLÓï¾ä

Èç¹ûÄã¾­³£Óöµ½ÏÂÃæµÄÎÊÌ⣬Äã¾ÍÒª¿¼ÂÇʹÓÃSQL ServerµÄÄ£°åÀ´Ð´¹æ·¶µÄSQLÓï¾äÁË£º
SQL³õѧÕß¡£
¾­³£Íü¼Ç³£ÓõÄDML»òÊÇDDL SQL Óï¾ä¡£
ÔÚ¶àÈË¿ª·¢Î¬»¤µÄSQLÖУ¬Ã¿¸öÈ˶¼ÓÐ×Ô¼ºµÄSQLϰ¹ß£¬Ã»ÓÐÒ»Ì×ͳһµÄ¹æ·¶¡£
ÔÚSQL Server Management StudioÖУ¬ÒѾ­¸ø´ó¼ÒÌṩÁ˺ܶೣÓõÄÏÖ³ÉSQL¹æ·¶Ä£°å¡£
SQL Server Management ......

SQL JOIN µÄÓ÷¨

¶ÔÓÚSQLÎÒҲѧϰÁË£¬µ«ÊÇÕæÕýÓõ½µÄʱºò²ÅÖªµÀºÜ¶à¶«Î÷»¹²»Ì«Àí½â£¬ÔÚÍøÉÏ¿´ÁËһϣ¬ÕâÆªÎÄÕÂÖн²µÄºÜºÃ£¬ËùÒÔÄÃÀ´ºÍ´ó¼Ò·ÖÏíһϣº
SQL JOIN µÄÓ÷¨
¹ØÓÚsqlÓï¾äÖеÄÁ¬½Ó£¨join£©¹Ø¼ü×Ö£¬ÊǽÏΪ³£ÓöøÓÖ²»Ì«ÈÝÒ×Àí½âµÄ¹Ø¼ü×Ö£¬ÏÂÃæÕâ¸öÀý×Ó¸ø³öÁËÒ»¸ö¼òµ¥µÄ½âÊÍ --½¨±ítable1,table2£º
create table table1(id int,n ......

SQL Server Ë÷Òý»ù´¡ÖªÊ¶(2)

£¨http://www.builder.com.cn/2008/0211/733054.shtml£© »ù´¡ÖªÊ¶£¨4£©
²»ÂÛÊÇ ¾Û¼¯Ë÷Òý£¬»¹ÊǷǾۼ¯Ë÷Òý£¬¶¼ÊÇÓÃB+Ê÷À´ÊµÏֵġ£ÎÒÃÇÔÚÁ˽âÕâÁ½ÖÖË÷Òý֮ǰ£¬ÐèÒªÏÈÁ˽âB+ͨ¹ý×ܽᣬÎÒ·¢ÏÖ×Ô¼ºÒÔǰºÜ¶àºÜÄ£ºýµÄ¸ÅÄî¶¼ÇåÎúÁ˺ܶࡣ
²»ÂÛÊÇ ¾Û¼¯Ë÷Òý£¬»¹ÊǷǾۼ¯Ë÷Òý£¬¶¼ÊÇÓÃB+Ê÷À´ÊµÏֵġ£ÎÒÃÇÔÚÁ˽âÕâÁ½ÖÖË÷Òý֮ǰ£¬ÐèÒªÏÈ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ