¡¾Ð¡Ð¡ÎÊÌ⼯½õ13Ö® ¹ØÓÚ·Ö×é¼Ó˳ÐòºÅµÄSQLд·¨¡¿
/*
Ô±í£º
thid other
a 1
a 1
b 0
b 0
b 0
c 2
c 2
Ï£Íû±ä³É£º
thid other
a 1
a 2
b 0
b 1
b 2
c 2
c 3
*/
if OBJECT_ID('tb') is not null
drop table tb
go
create table tb (id varchar(10) ,value int)
insert tb select
'a' , 1 union all select
'a' , 1 union all select
'b' , 0 union all select
'b' , 0 union all select
'b' , 0 union all select
'c' , 2 union all select
'c' , &nb
Ïà¹ØÎĵµ£º
--ÏÔʾ°æ±¾ºÅ£¬µ±Ç°ÈÕÆÚ
SELECT VERSION(),CURRENT_DATE(),NOW();
--Ãâ·ÑµÄ¼ÆËãÆ÷
SELECT (20+5)*4 AS RESULT,SIN(PI()/3);
--´´½¨Êý¾Ý¿â
CREATE DATABASE databasename;
--ɾ³ýÊý¾Ý¿â
DROP DATABASE databasename;
--ÏÔʾµ±Ç°´æÔÚµÄÊý¾Ý¿â
SHOW DATABASES;
--Ñ¡ÔñÊý¾Ý¿â
USE ......
http://www.cnblogs.com/yinzhenzhixin/archive/2009/01/07/1371064.html
ÔÚSQLÓï¾äÖУ¬UNION¹Ø¼ü×Ö¶àÓÃÀ´½«²¢ÁеĶà×é²éѯ½á¹û(±í)ºÏ²¢³ÉÒ»¸ö½á¹û(±í)£¬¼òµ¥ÊµÀýÈçÏ£º
SELECT [Id],[Name],[Comment] from [Product1]
UNION
SELECT [Id],[Name],[Comment] from [Product2]
ÉÏÃæµÄ´úÂë¿ ......
Last login: Mon Feb 8 14:13:19 2010 from 192.168.1.249
ipnet
-bash-3.00$
-bash-3.00$ ipnet
-bash: ipnet: command not found
-bash-3.00$ su - oracle
Password:
eastcsu: incorrect password
-bash-3.00$ eastcom
-bash: eastcom: command not found
-bash-3.00$ su - oracle
Password:
[oracl ......
select *from student
select student_id from student
select student_id ,student_name from student
select student_id student_name from student ½«student_name ×÷Ϊstudent_idµÄ±ðÃû´¦Àí
È磺 select student_id a from student
select a=student_id from student
´Óstudent±íÖзֱð¼ ......
Êý¾Ý¿âµÄÐÔÄܲâÊÔ¿ÉÒÔ°ïÖúÄãÌáǰ֪µÀÄãµÄϵͳµÄ¸ºÔØÄÜÁ¦£¬¿ÉÒÔ°ïÖúÄã¸Ä½øÏµÍ³µÄʵʩ»òÉè¼Æ£¬¿ÉÒÔ°ïÖúÄãÈ·¶¨Ò»Ð©Éè¼ÆºÍ±à³ÌÔÔò. µ«ÊÇ£¬ÕâÀïÃæÒ²ÓÐÏÝÚå. Èç¹û²»Ð¡ÐÄ£¬Äã»á×Ô¼º°Ñ×Ô¼ºÏݽøÈ¥£¬È´×îÖÕ²»Ã÷°×ÊÇʲôÔÒò. ÕâÀÎÒÄÃһλÏÈÉúΪÀý£¬À´¿´¿´ËûÔõô×Ô¼º°Ñ×Ô¼º¸ãºýÍ¿µÄ.
×î½ü, ÏëÆðÔÚ´æ´¢¹ý³ÌÖо¿¾¹ÊÇʹÓÃÁÙʱ±í»¹ÊÇÊ ......