- 2
- 0
- 约1.6万字
- 约 47页
- 2017-04-06 发布于四川
- 举报
数据库Oracle第3课时1
例4:找出在同一城市居住的顾客对。 写SQL Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. 例4:找出在同一城市居住的顾客对。 SELECT c1.cid, c2.cid FROM customers c1, customers c2 WHERE c1.city = c2.city; 为了不重复列出, 另外自身配对不列出,可以 WHERE c1.city = c2.city AND c1.cid c2.cid; Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. 例5:找出比Smith工资高的代理商。 SELECT a2.aname FROM agents a1, agents a2 WHERE a1.aname = ‘Smith’ AND a2.salary a1.salary; 例6:写出购买过商品的顾客姓名和产品名称。(多表连接) SELECT c.cname, p.pname FROM customers c, products p, orders o WHERE o.cid = c.cid AND o.pid = p.pid; 一般来说,N个表连接需要N-1个连接条件。 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. 例7:写出购买过单价超过1元的产品的顾客名单。(多表连接) SELECT c.cname FROM orders o, customers c, products p WHERE o.cid = c.cid AND o.pid = p.pid AND p.price 1; Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. 例8:找出与经理在同一城市的代理商。 写SQL Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. 例8:找出与经理在同一城市的代理商。 SELECT a2.aname FROM agents a1, agents a2, locations l1, locations l2 WHERE a1.manager = a2.aid AND a1.lid = l1.lid AND a2.lid = l2.lid AND l1.c
您可能关注的文档
- 江苏省金湖中学2012-2013年度高一上学期期末考试化学试题附解析.doc
- 江苏省金湖中学2012-2013年度高一上学期期末考试历史试题附解析.doc
- 江苏省金湖中学2012-2013年度高一上学期期末考试政治试题附解析.doc
- 江苏省金湖中学2012-2013年度高一上学期期末考试物理试题附解析.doc
- 江苏省金湖中学2012-2013年度高一上学期期末考试数学试题附解析.doc
- 江苏省金湖中学2012-2013年度高一上学期期末考试生物试题附解析.doc
- 江苏省金湖中学2012-2013年度高一上学期期末考试英语试题附解析.doc
- 云南省滇池中学11-12届高一上学期期末考试 数学试卷.doc
- 江苏省金湖中学2012-2013年度高一下学期期初考试化学试题附解析.doc
- 云南省滇池中学11-12届高一上学期期末考试 英语试卷.doc
- 伟明环保-市场前景及投资研究报告-境内业务稳健运行,印尼市场贡献边际增量.pdf
- 桂东县法院系统招聘考试真题2025.pdf
- 贵州省黔南布依族2026年中考三模物理试题及答案.pdf
- 贵州省黔南州2026年中考语文二模试卷附答案.pdf
- 贵州省铜仁市2026年中考语文二模试卷附答案.pdf
- 2026上半年安徽事业单位联考合肥市庐江县招聘36人备考题库及一套完整答案详解.docx
- 贵州省毕节市2026年中考语文一模试卷附答案.pdf
- 贵州省贵阳市南明区2026年中考语文一模试卷附答案.pdf
- 2026上半年安徽事业单位联考合肥市庐江县招聘36人备考题库及一套参考答案详解.docx
- 贵州省贵阳市白云区2026年中考二模物理试题附答案.pdf
原创力文档

文档评论(0)