diff --git a/数据库系统原理与实践/平时作业/第四次作业.tex b/数据库系统原理与实践/平时作业/第四次作业.tex index d9baded..cfff4ce 100644 --- a/数据库系统原理与实践/平时作业/第四次作业.tex +++ b/数据库系统原理与实践/平时作业/第四次作业.tex @@ -230,32 +230,35 @@ where not not exists(select * from account where PRODUCT_CD = 'CS' and account.C 其他年无交易记录,不要,要 \end{csv} \begin{minted}{SQL} -select ACCOUNT_ID +select account.ACCOUNT_ID from account - left join (select * + left join (select ACCOUNT_ID from acc_transaction - where year(TXN_DATE) != 2013) as not2013 using (ACCOUNT_ID) -where TXN_DATE is not null; + where year(TXN_DATE) = 2013) as _2013 on account.ACCOUNT_ID = _2013.ACCOUNT_ID +where _2013.ACCOUNT_ID is null +order by account.ACCOUNT_ID; \end{minted} - \begin{csv} + \small\begin{csv} ,ACCOUNT_ID -1,4 -2,5 -3,18 -4,19 -5,21 -6,28 -7,10 -8,17 -9,13 -10,29 -11,27 -12,3 -13,23 -14,12 -15,22 -16,15 -17,28 +1,1 +2,2 +3,3 +4,5 +5,10 +6,11 +7,12 +8,13 +9,15 +10,17 +11,18 +12,19 +13,21 +14,22 +15,23 +16,27 +17,28 +18,29 +19,30 \end{csv} } \questionandanswer[]{