在excel中查询sql数据库
时间:2023-01-08 11:07:59
查询是数据库最常用的操作,也是最重要的操作.SQL语言提供了SELECT语句进行数
据库的查询,该语句的一般格式如下:
SELECT select list
FROM table source
!WHE咫search_ condition]
[GROUP BY group一y_expression]
I HAVING search condition]
[ ORDER BY order expression[ASC I DESC]]
其主要元素说明如下:
select list要选择的列或表达式的集合。
table source基本表或者视图的集合.
search condition进行查询的条件.
groupee by_expression可以根据某些特定的列进行分组。
search condition分组的条件值.
order expression查询结果是按照列的集合来进行升序或者降序排序.
由于SELECT语句的复杂性,一下面例子涉及到一个客户、订单数据库。
客户基本信息表:
Customer(CustomerlD,CompanyName,Address,City, Phone, Fax)
Customer由客户编号(CustomerlD )、公司名称(CompanyName)、公司地址(Address) .
公司所在城市(City)、公司电话(Phone)和传真(Fax) 6个属性组成,其中客户编号
(CustomerlD )是关键字.
商品信息表:
Product(ProductID, ProductName,UnitPrice)
Product山产品编号(ProductID )、产品名称(ProductName)和产品单价(UnitPrice )
3个属性组成,其中产品编号(ProductID )是关键字。
客户汀单表:
Orders(OrderlD,CustomerID,ProductID,OrderDate,RequiredDate,OrderQuantity)
Order由订单编号(OrderlD )、客户编号(CustomerlD )、产品编号(ProductID )、
订单日期(OrderDate )、订单预交日(RequiredDate)和订单数量(OrderQuantity) 6个属
性组成,其中OrderlD是关键字.
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
如何为 word 文档设置文字水印
![](https://img.aspxhome.com/file/2023/3/33183_0s.jpg)
word2013怎么合并多个文档?word2013合并多个文档方法步骤
![](https://img.aspxhome.com/file/2023/5/29175_0s.png)
4个超好用的Word技巧
Word 2010中前面几页不显示页码的方法
![](https://img.aspxhome.com/file/2023/4/20474_0s.jpg)
电脑开机pe选项怎么关闭?Win10取消开机pe选项的方法
![](https://img.aspxhome.com/file/2023/4/46434_0s.jpg)
如何给word2007文档加密?
![](https://img.aspxhome.com/file/2023/6/33846_0s.jpg)
win10专业版原版镜像在哪下载
![](https://img.aspxhome.com/file/2023/7/48227_0s.jpg)
Excel2016图表怎么更改图例坐在的位置?
![](https://img.aspxhome.com/file/2023/0/40490_0s.jpg)
Win10威胁服务已经停止立即重启怎么解决?
![](https://img.aspxhome.com/file/2023/7/51037_0s.jpg)
在excel表格中如何把姓和名字分成2列?
![](https://img.aspxhome.com/file/2023/6/41296_0s.jpg)
Word2003中出现打不开docx文件的处理方法
在Excel中如何对单元格文本或数字进行自定义排序?
![](https://img.aspxhome.com/file/2023/1/42241_0s.jpg)
怎么制作一个漂亮的Word文档封面?
![](https://img.aspxhome.com/file/2023/3/28923_0s.jpg)
word如何修改默认目录格式
在Word2010中设置"键入时自动套用格式"选项
![](https://img.aspxhome.com/file/2023/2/20492_0s.jpg)
怎么用Word画素描?
![](https://img.aspxhome.com/file/2023/0/24290_0s.png)
如何在Word中实现一栏与多栏文本快速混排
![](https://img.aspxhome.com/file/2023/9/33869_0s.jpg)
答疑解难:如何在Excel中输入数字0
![](https://img.aspxhome.com/file/2023/8/a143328_0s.gif)
如何查看Airpods序列号?Airpods序列号查看方法
![](https://img.aspxhome.com/file/2023/2/46182_0s.png)
PDF文件怎么修改页面颜色?
![](https://img.aspxhome.com/file/2023/4/15284_0s.jpg)