SQL Ìõ¼þÓï¾ä
µÚÒ»ÖÖ£º
SELECT
CASE
WHEN
price IS NULL THEN
'Not yet priced'
WHEN
price < 10 THEN
'Very Reasonable Title'
WHEN
price >= 10 AND
price < 20 THEN
'Coffee Table Title'
ELSE
'Expensive book!'
END
AS
"Price Category",
CONVERT(varchar(20), title) AS "Shortened Title"
from
pubs.dbo.titles
ORDER BY
price
µÚ¶þÖÖ£º
SELECT au_fname, au_lname,
CASE state
WHEN 'CA' THEN 'California'
WHEN 'KS' THEN 'Kansas'
WHEN 'TN' THEN 'Tennessee'
WHEN 'OR' THEN 'Oregon'
WHEN 'MI' THEN 'Michigan'
WHEN 'IN' THEN 'Indiana'
WHEN 'MD' THEN 'Maryland'
WHEN 'UT' THEN 'Utah'
END AS StateName
from pubs.dbo.authors
ORDER BY au_lname
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/hbzhangjian/archive/2006/07/31/1003684.aspx
SELECT top 2 id, uid,cn,
CASE len(cn)
WHEN 3 THEN 'California'
WHEN 2 THEN 'Kansas'
END AS StateName
from conf_users
Ïà¹ØÎĵµ£º
1¡¢ ´ò¿ªpl/sql ÖÐtools-preferences£¬ÉèÖÃConnectionÖеÄOracle HomeΪoracle9£¬OCI libraryΪoracle9 Èçͼ
2¡¢
½«oralce10Ŀ¼ÏµÄtnsnames.oraÎļþÀïÃæµÄËùÒªµ¼³öµÄoralce10µÄ·þÎñÅäÖà ¸´ÖƵ½oracle9Ŀ¼ÏµÄtnsnames.oraÎļþÀïÃæ
ORCL =
(DESCRIP ......
ÎÊÌâ¼°ÃèÊö£º
--1.ѧÉú±í
Student(S#,Sname,Sage,Ssex) --S# ѧÉú±àºÅ,Sname ѧÉúÐÕÃû,Sage ³öÉúÄêÔÂ,Ssex ѧÉúÐÔ±ð
--2.¿Î³Ì±í
Course(C#,Cname,T#) --C# --¿Î³Ì±àºÅ,Cname ¿Î³ÌÃû³Æ,T# ½Ìʦ±àºÅ
--3.½Ìʦ±í
Teacher(T#,Tname) --T# ½Ìʦ±àºÅ,Tname ½ÌʦÐÕÃû
--4.³É¼¨±í
SC(S#,C#,score) --S# ѧÉú±àºÅ,C# ¿Î³Ì ......
µ±Ê¹ÓÃMicrosoft SQL Server 2008 Management Studioʱ£¬ÓÐʱÔÚ±íÉè¼ÆÆ÷ÖжԱíËù×öµÄ¸ü¸ÄÎÞ·¨±£´æ£¬¾ßÌå±íÏÖΪ£ºµã»÷±£´æ°´Å¥ºóµ¯³ö±£´æ¶Ô»°¿òÌáʾ£º²»ÔÊÐí±£´æÐÞ¸Ä(Saving changes is not permitted)£¬µ¯³öµÄ¶Ô»°¿òÖ»ÓÐ2¸ö°´Å¥¿ÉÒÔµã»÷£¬Ò»¸öCancelÒ»¸öSave Text File£¬Ç°Ò»¸ö¾Í²»ÓÃ˵ÁË£¬ºóÒ»¸ö±£´æµÄÎļþ¸ù±¾Ã»ÒâÒ壨¿ÉÒ ......
±¾ÎÄÀ´×Ô£ºhttp://hi.baidu.com/darkroot/blog/item/7b74be2cf06d76e78b139903.html
declare @tbName nvarchar(500)
declare @ct int
declare @csql nvarchar(500)
declare &n ......