




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、數(shù)據(jù)庫系統(tǒng)原理實驗報告姓名:姜秀連指導(dǎo)教師:康輝學(xué)號:55140727實驗日期:2016年6月14日一、實驗?zāi)康?、鞏固數(shù)據(jù)庫的基礎(chǔ)知識;2、了解結(jié)構(gòu)化查詢語言SQL的概念及其特點;3、學(xué)習(xí)使用SQLServer2000數(shù)據(jù)庫管理系統(tǒng)軟件的一些基本操作;4、掌握用SQL創(chuàng)建數(shù)據(jù)庫的兩種方法;5、 掌握用SQL創(chuàng)建數(shù)據(jù)表的方法;6、 掌握數(shù)據(jù)表的更新的方法;7、 掌握數(shù)據(jù)表的各種查詢方法。2、 實驗原理:創(chuàng)建數(shù)據(jù)庫,準(zhǔn)備數(shù)據(jù),根據(jù)題目寫sql語句三、基本操作創(chuàng)建數(shù)據(jù)庫,準(zhǔn)備數(shù)據(jù),根據(jù)題目寫sql語句四、實驗內(nèi)容及數(shù)據(jù)記錄1、 Find the name, loan number and loan
2、 amount of all customers; rename the column name loan_number as loan_id.select customer.customer_name, loan.loan_number ,loan.amount from customer,loan,borrower where customer.customer_name =borrower.customer_name and borrower.loan_number=loan.loan_numberalter table loan change column loan_number lo
3、an_id varchar (255) not null2、 Find the names of all customers whose street includes the substring “Main”.select * from customer where customer_street like %Main%3、 Find all customers who have a loan, an account, or both:Select customer.customer_name from customer,depositor,account,borrower,loanWher
4、e depositor.customer_name=customer.customer_name or customer.customer_name=borrower.customer_name group by customer.customer_name4、 Find all customers who have both a loan and an account.Select customer.customer_name from customer,depositor,account,borrower,loanWhere depositor.customer_name=customer
5、.customer_name and customer.customer_name=borrower.customer_name group by customer.customer_name5、 Find all customers who have an account but no loan.Select distinct customer.customer_name from customer,depositor,borrowerWhere depositor.customer_name=customer.customer_nameandcustomer.customer_name n
6、ot in(Select customer.customer_name from customer,depositor,borrowerWhere customer.customer_name=borrower.customer_name)6、 Find the average account balance at the Perryridge branch.select avg(balance) from account where branch_name=Perryridge7、 Find the number of tuples in the customer relation.sele
7、ct count(customer_name) from customer8、 Find the number of depositors in the bank.Select count(customer.customer_name) from branch,account,depositor,customerWhere branch.branch_name=account.branch_name and account.account_number=depositor.account_number and depositor.customer_name=customer.customer_
8、name9、 Find the number of depositors for each branch.Select branch.branch_name,count(customer.customer_name) from branch,account,depositor,customerWhere branch.branch_name=account.branch_name and account.account_number=depositor.account_number and depositor.customer_name=customer.customer_namegroup
9、by branch.branch_name10、 Find the names of all branches where the average account balance is more than $1,200.selectbranch_name,avg(balance)fromaccountgroupbybranch_namehavingavg(balance)120011、Find all loan number which appear in the loan relation with null values for amount.selectloan_numberfromlo
10、anwhereamountisnull12、 Find all customers who have both an account and a loan at the bank.select customer_name from depositorINTERSECTselect customer_name from borrowerSelect distinct c.customer_name from customer c ,depositor d ,borrower b where c.customer_name=d.customer_name and c.customer_name=b
11、.customer_name 13、 Find all customers who have a loan at the bank but do not have an account at the bankSelect distinct customer.customer_name from customer,depositor,borrowerWhere customer.customer_name=borrower.customer_nameandcustomer.customer_name not in(Select customer.customer_name from custom
12、er,depositor,borrowerWhere depositor.customer_name=customer.customer_name)14、 Find all customers who have both an account and a loan at the Perryridge branchSelect distinct c.customer_name from customer c,account a,loan l,depositor d,borrower bwhere c.customer_name=d.customer_name and d.account_numb
13、er=a.account_number and a.branch_name=Perryridgeand c.customer_name=b.customer_name and b.loan_number=l.loan_numberand l.branch_name=Perryridge15、 Find all branches that have greater assets than some branch located in Brooklyn.Select branch.* from branch where assets(select min(assets) from branch where branch_city=Brooklyn)16、 Find the names of all branches that have greater assets than all branches located in Brookly
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 《貴州飛尚能源有限公司六枝特區(qū)興旺煤礦(變更)礦產(chǎn)資源綠色開發(fā)利用方案(三合一)》評審意見
- 珠寶相關(guān)知識培訓(xùn)課件
- 2025年汕尾下載b2貨運從業(yè)資格證模擬考試考試
- 印度課件+-2024-2025學(xué)年人教版七年級地理下冊
- 養(yǎng)殖寵物基本知識培訓(xùn)課件
- 第二單元空氣和氧氣課題3制取氧氣 第1課時實驗室制取氧氣的原理 分解反應(yīng)教學(xué)設(shè)計-2024-2025學(xué)年九年級化學(xué)人教版(2024)上冊
- 2025年西藏貨運從業(yè)證考試內(nèi)容
- 四川省南川區(qū)川東北名校2024-2025學(xué)年高二(上)期末物理試卷【含解析】
- 上海市靜安區(qū)華東模范中學(xué)2024-2025學(xué)年高一(上)期末物理試卷【含解析】
- 2025屆新高考?xì)v史沖刺熱點復(fù)習(xí)中華文明的形成和發(fā)展時期-秦漢
- 2024年港作拖輪項目可行性研究報告
- 2025年甘南州國控資產(chǎn)投資管理集團限公司人員招聘13人高頻重點提升(共500題)附帶答案詳解
- 2025年四川成都農(nóng)業(yè)科技中心管理人員招聘1人歷年高頻重點提升(共500題)附帶答案詳解
- 2025上海大學(xué)行政管理崗位及部分教育輔助崗位公開招聘19人高頻重點提升(共500題)附帶答案詳解
- 巨量千川(中級)營銷師認(rèn)證考試題庫(附答案)
- 地震應(yīng)急預(yù)案桌面演練
- 安防監(jiān)控基礎(chǔ)知識培訓(xùn)
- 擺攤合伙經(jīng)營合同范例
- TCABEE 063-2024 建筑光儲直柔系統(tǒng)變換器 通 用技術(shù)要求
- 【核心素養(yǎng)目標(biāo)】浙教版勞動七下項目一任務(wù)一《學(xué)做小籠包》課件
- 雅禮中學(xué)2024-2025學(xué)年初三創(chuàng)新人才選拔數(shù)學(xué)試題及答案
評論
0/150
提交評論