版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、數(shù)據(jù)庫系統(tǒng)原理實驗報告姓名:姜秀連指導教師:康輝學號:55140727實驗日期:2016年6月14日一、實驗目的1、鞏固數(shù)據(jù)庫的基礎知識;2、了解結構化查詢語言SQL的概念及其特點;3、學習使用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ù)庫,準備數(shù)據(jù),根據(jù)題目寫sql語句三、基本操作創(chuàng)建數(shù)據(jù)庫,準備數(shù)據(jù),根據(jù)題目寫sql語句四、實驗內容及數(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)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 基礎會計課件
- 單位管理制度展示合集員工管理十篇
- 單位管理制度展示大全人事管理篇
- 電子行業(yè)年度策略報告:科技自立AI具能
- 單位管理制度品讀選集【人力資源管理篇】
- 2024年江蘇工程職業(yè)技術學院單招職業(yè)技能測試題庫附答案
- 遼陽檢驗檢測儀器項目投資分析報告
- 2025外來員工勞動合同「版」
- Unit 2 單元課后培優(yōu)練(原卷版)
- 山東發(fā)電機及發(fā)電機組制造市場前景及投資研究報告
- 愛上國樂智慧樹知到答案章節(jié)測試2023年東華理工大學
- 高中新教材化學必修一課后習題答案(人教版)
- GB/T 19326-2022鍛制支管座
- GB/T 9740-2008化學試劑蒸發(fā)殘渣測定通用方法
- GB/T 7424.1-1998光纜第1部分:總規(guī)范
- 拘留所教育課件02
- 兒童營養(yǎng)性疾病管理登記表格模板及專案表格模板
- 天津市新版就業(yè)、勞動合同登記名冊
- 數(shù)學分析知識點的總結
- 2023年重癥醫(yī)學科護理工作計劃
- 年會抽獎券可編輯模板
評論
0/150
提交評論