ä¯ÀÀLINQ to SQL¹ØÏµ
±êÇ©£ºÊý¾Ý·ÃÎÊ LINQ LINQ to SQL ²¿·Ö
ä¯ÀÀLINQ to SQL¹ØÏµ Á½¸ö¹ØÁªµÄ±í£º
½«Á½¸öÓÐÁªÏµµÄ±í¼ÓÈëdbmlÎļþÖУ¬±ÈÈ磺Customers±í ºÍ Orders±í£¬Á½¸ö±íͨ¹ýCustomerIDs½¨Á¢ÁªÏµ£» O/RÉè¼ÆÆ÷»á×Ô¶¯¼ì²âµ½±íÖ®¼äµÄ¹ØÏµ£¬ËùÒÔÔÚCustomersÀàÖÐÌí¼ÓÒ»¸öOrders³ÉÔ±£¬À´±íʾ¸Ã¹ØÏµ¡£ Àý£º AreslabDataContext aresData = new AreslabDataContext(); var queryResults = from c in aresData.Customers where c.Country =="USA" select new { ID=c.CustomerID,
.....
Ïà¹ØÎĵµ£º
First:
create table gobo.gobo_om_reservations_2008b as
select * from gobo_om_reservations
where to_char(CREATION_DATE,'yyyy')<'2008'
delete from gobo_om_reservations
where to_char(CREATION_DATE,'yyyy')<'2008'
commit
After 2009Year:
create table gobo.gobo_om_reservations_????b as ......
select d.code,d.name, sum(w.weight) weight,round(avg(w.price),2) price,sum(w.money) money
from weight_info w left outer join t_dict d on w.productcode=d.code left outer join t_balancecode b on w.balancecode=b.balancecode where 1=1 and w.operdate>TO_TIMESTAMP('2009-11-2 04:12:32.0', ' ......
Student(S#,Sname,Sage,Ssex) ѧÉú±í
Course(C#,Cname,T#) ¿Î³Ì±í
SC(S#,C#,score) ³É¼¨±í
Teacher(T#,Tname) ½Ìʦ±í
ÎÊÌ⣺
1¡¢²éѯ“001”¿Î³Ì±È“002”¿Î³Ì³É¼¨¸ßµÄËùÓÐѧÉúµÄѧºÅ£»
select a.S# from (select s#,score from SC where C#='001') a,(select s#,score
fr ......
Ò»¡¢ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¡¡¡¡Êµ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄsql serverÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý£¨clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý£©ºÍ·Ç¾Û¼¯Ë÷Òý£¨nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý£©¡£ÏÂÃæ£¬ÎÒÃǾÙÀýÀ´ËµÃ÷һϾۼ¯Ë÷ÒýºÍ·Ç¾Û¼¯Ë÷ÒýµÄÇø±ð£º
¡¡¡¡Æäʵ£¬ÎÒÃǵĺºÓï× ......