版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、专业、班级: 学号: 姓名:密 封 线浙江财经学院期中考试试卷数据库原理及应用(英)课程试卷考核方式: 闭 卷 考试日期:2012年11月21日适用专业、班级:10电子商务题 号一二三四五六七八九十总分得 分评卷人(共 7 大题)1. For each of the following questions there are four choices marked A, B, C and D. Only one of them is correct. You should decide on the correct choice and write down its mark on the a
2、nswer sheet.(Points: 20 )(1) Which of the following operations is not supported by DDL ? CAcreating some views in a databaseBmodifying table structures in a databaseCfinding some rows from a tableDcreating some tables in a database(2) In relational model, entity integrity means that B .Athere must n
3、ot be empty rows in every relationBno attribute of a primary key can be nullCattributes are allowed to be nullDforeign keys are allowed to be null(3) Which of the following operations is not supported by DML ? DAinserting some rows into a tableBdeleting some rows from a tableCfinding some rows from
4、a tableDcreating some tables in a database(4) If F is a foreign key of relation R that references the primary key K of relation S, then F can only take B .Anull valuesBnull values or values that equal to one of the values of KCvalues that appear in KDvalues that appear in R(5) Which of the following
5、 operations can retrieve from a relation all records that satisfy a condition to form a new relation? CAProjection BJoinCSelectionDDivision(6) A relation schema _C_.Acan have exactly one candidate key Bcan have many primary keysCcan have one or many candidate keys Dcan have one or many primary keys(
6、7) In SQL, in order to add a new column CN into base table S, we use C statement.AADD TABLE S(CN CHAR(8) BADD TABLE S ALTER(CN CHAR(8)CALTER TABLE S ADD CN CHAR(8) DALTER TABLE S (ADD CN CHAR(8)(8) For a relation, each candidate key C .Acan only have at least two attributesBcan only have at most one
7、 attributesCmay have one or more attributesDmust contain all the attributes of the relation(9)Suppose Relation R1, R2 and R3 have K1, K2 and K3 tuples , respectively, then the number of tuples in R1´R2´R3 will be _A_.AK1´ K2´ K3BK1+ K2+ K3C(K1+ K2)´K3D(K1+ K2)÷K3(10)In
8、SQL, views are corresponding to the _A_ schema of a database.AexternalBconceptualCinnerDstorage2. Given the following descriptions, create an appropriate ER diagram for the management of the Library. (point:20)They have a number of suppliers that supply the products for sale. Each supplier has a uni
9、que supplier number, and the name, city and telephone number. A supplier can supply several kinds of products and one kind of products may be supplied by several suppliers. The supply information includes supply date, price and supply quantity.They have many kinds of products that they provide to th
10、eir customers. Each product has a unique product number, and the name, type, color, quantity, together with a cost and a price. They have a number of customers. Each customer is given a unique customer number. Each customer has a name, customer addresses, DOB(date of birth), gender(性别),postcode, the
11、 customer telephone number and Email. A customer may place zero, one or more orders at a time, and an order is always placed by one customer alone. Each order has a unique order number, the date ordered, the date due, the total price, and the status.An order may include one or more than one products
12、, and a product may be included in more than one order. For each product being ordered in an order, its quantity, price are recorded.Supp_NumberSCitySupplierSnameTelephonecolorcostpriceproductsP_numberPnameTypeStock-quantityCust_NumberDOBAdrresscustomerCnameTelephoneEmailPostcodestatusorderOrd_numbe
13、rDate_dueTotal_priceDate_orderedproductorderscustomerdetailsPlace_orderquantityprice1nsuppliersupplydatequantitypricenmmn3. The following tables form part of a database held in a relational DBMS.Product(P_number, Name, type, cost, price, description, produce_time, useful-life)Customer(Cust_Number, F
14、name, Lname, Address, profession, birthday, sex)Order(Ord_number, Cust_Number, date, Date_due, Total_price, Ord-status)Details(Ord_number, P_number, quantity,status)Where Product contains product details and P_number is the primary key. Customer contains customer details for each hotel. Each custome
15、r can play one or more orders and each order is played by one customer. Each order includes one or more products. The statue of order denotes whether the order is completed, valued as unaffirmed(未确认),affirmed(已确认),outstanding(已付款待送货), delivered(已送货) and invoice(已开发票).(a) Formulate the following quer
16、ies in RA and SQL respectively: (point:30) (1) List full details of all customers in shanghai.dAdress=shanghai(Customer)Select *From CustomerWhere Address like shanghai%(2) List all the orders that are outstanding, include order_number, date, Date-due, customers name, address, product and status, or
17、der by date.Ord_number,Date,Date-due,Fname,Lname,Address,Name,status (dOrd_status=Outstanding(OrderDetailsCustomerProduct)Select Ord_number,Date,Date-due,Fname,Lname,Address,Name,statusFrom (Order O join Details D on O.Ord_number=D.Ord_number) join Customer C on O. Cust_Number=C. Cust_Number) join P
18、roduct P on D. P_number=P. P_numberWhere Ord_status=OutstandingOrder by Date(3) List all fresh milk products by names , prices and produce time.Name,price,produce_time (dNames=fresh milk(Product)Select Name,price,produce_timeFrom ProductWhere Names=fresh milk(4) List the information of customers who
19、 have never played an order.Cust_Number, , Fname, Lname(Customer)- Cust_Number, , Fname, Lname(CustomerOrders)Select Cust_Number, Fname, Lnamefrom customerwhere Cust_Number not in(select Cust_Number, from Orders)(5) List the numbers, names and quantities of products that bought by the customer named
20、 John.P_number,Name,Quantity (dLname=John(OrderDetailsCustomerProduct)Select P_number,Name,QuantityFrom (Order O join Details D on O.Ord_number=D.Ord_number) join Customer C on O. Cust_Number=C. Cust_Number) join Product P on D. P_number=P. P_numberWhere Lname=John(b) Formulate the following questio
21、ns in SQL: (point:30)(5) How many products of each type?Select count(*)From ProductGroup by type(6) What is the total revenue today?Select sum(Total_price)From OrderWhere Date=getdate()(7) How many kind of products that have never purchased by customers?Select count(*)From ProductWhere P_number NOT
22、in( Select P_number From Details)(8) Move all the orders and their details with a date before 2010-12-31 from Order and Details to their archive tables called Order_archive and Detail_archive, the archive table have same structure.(First insert the information into two new tables ,and then delete fr
23、om) (12points)Insert into Order_archive(Ord_number, Cust_Number, date, Date_due, Total_price, Ord-status)Select Ord_number, Cust_Number, date, Date_due, Total_price, Ord-statusFrom OrderWhere Date<=2010-12-31Insert into Details_archive(Ord_number, P_number, quantity,status)Select Ord_number, P_number, quantity,statusFrom DetailsWhere Ord_number in(select OrdnumberFrom OrderWh
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 燃气门站安全运行方案
- PDP性格测试(完整版题目+详细真人版解析)
- 2026年特种设备安全管理人员安全操作知识模拟试卷(附答案)
- 2026年出版专业初级职业资格考试编辑加工与校对模拟试题含答案
- 危险化学品经营安全技术操作规程
- PCB专业技能考核试题(含详细答案)
- 自动售检票系统运维安全操作规程
- 2026年家庭药师服务需求试题及答案
- 2026年陕西省人力资源和社会保障厅下属事业单位考试真题(附答案)
- 施工现场卫生防疫及消杀工作方案
- 2025年6月浙江省高考化学试卷真题(含答案及解析)
- 《中药炮制学》课程教学大纲
- 心力衰竭消化道出血课件
- 辽宁现代服务职业技术学院单招数学真题及完整答案详解【考点梳理】
- 内衬(覆)不锈钢复合钢管管道工程技术规程
- 高中数学分层练习(基础题):圆锥曲线(60题)
- 院前急救病历书写规范
- 电梯维修培训教程
- 《伤寒论》课件-葛根黄芩黄连汤证
- 机械制造加工车间安全手册
- 社区综合治理工作汇报
评论
0/150
提交评论