ImageVerifierCode 换一换
格式:DOCX , 页数:77 ,大小:46.60KB ,
资源ID:15684264      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/15684264.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(SQL语言在ACCESS数据库中的应用Word下载.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

SQL语言在ACCESS数据库中的应用Word下载.docx

1、说明predicate下列谓词之一:ALL、DISTINCT、DISTINCTROW 或 TOP。可以使用谓词来限定返回记录的数量。如果没有指定谓词,则默认值为 ALL。*指定选择指定表中的所有字段。table表的名称,该表包含从中选择记录的字段。field1、field2字段名,这些字段包含了要检索的数据。如果包括多个字段,将按它们的排列顺序对其进行检索。alias1 和 alias2用作列标题的名称,不是 table 中的原始列名。tableexpression表名称,其中包含要检索的数据。externaldatabase如果 tableexpression 中的表不在当前数据库中,则使用

2、该参数指定该数据库名。若要执行此项操作,Microsoft Jet 数据库引擎会搜索指定的表,并提取选定的列,再选择符合条件的行,然后按指定的顺序对得到的行进行排序或分组。SELECT 语句不会更改数据库中的数据。SELECT 通常是 SQL 语句中的第一个词。大多数 SQL 语句都是 SELECT 或 SELECT.INTO 语句。SELECT 语句最简化的语法为:SELECT fields FROM table可以通过星号 (*) 来选择表中所有的字段。以下的示例选择在 Employees 表中的所有字段:SELECT * FROM Employees;如果一个字段名包括于 FROM 子句

3、的多个表中,请在该字段前面加上表名和 .(圆点)号。在下面的示例中,Department 字段同时存在于 Employees 表和 Supervisors 表中。SQL 语句从 Employees 表中选择出部门并从 Supervisors 表中选择出主管名:SELECT Employees.Department, Supervisors.SupvNameFROM Employees INNER JOIN SupervisorsWHERE Employees.Department = Supervisors.Department;创建 Recordset 对象时,Microsoft Jet 数

4、据库引擎将使用表的字段名作为 Recordset 对象中的 Field 对象名。如果需要其他字段名或者名称不适合用来生成该字段的表达式,请使用 AS 保留字。以下示例使用标题 Birth 来命名生成的 Recordset 对象中的返回 Field 对象:SELECT BirthDateAS Birth FROM Employees;只要使用的聚合函数或查询返回的是不明确的或重复的 Field 对象名称,就必须使用 AS 子句为该 Field 对象另外提供一个替代名称。以下示例使用标题 HeadCount 来命名生成的 Recordset 对象中的返回 Field 对象:SELECT COUNT

5、(EmployeeID)AS HeadCount FROM Employees;可以在 SELECT 语句中使用其他子句进一步约束和组织所返回的数据。有关详细信息,请参阅相应子句的帮助主题。示例下面的一些示例假定 Employees 表中存在一个假想的 Salary 字段。请注意,该字段实际并不存在于罗斯文数据库的 Employees 表中。 本例基于 SQL 语句创建一个动态集类型的 Recordset,该语句选择 Employees 表中所有记录的 LastName 和 FirstName 字段。它调用 EnumFields 过程,该过程将 Recordset 对象的容显示到调试窗口。Su

6、b SelectX1() Dim dbs As Database, rst As Recordset Modify this line to include the path to Northwind on your computer. Set dbs = OpenDatabase(Northwind.mdb) Select the last name and first name values of all records in the Employees table. Set rst = dbs.OpenRecordset(SELECT LastName, _ & FirstName FR

7、OM Employees; Populate the recordset. rst.MoveLast Call EnumFields to print the contents of the Recordset. EnumFields rst,12 dbs.CloseEnd Sub以下示例计算 PostalCode 字段中有条目的记录数,并将返回的字段命名为 Tally。Sub SelectX2() Count the number of records with a PostalCode value and return the total in the Tally field.SELECT

8、 Count (PostalCode) AS Tally FROM Customers; Populate the Recordset. Call EnumFields to print the contents of the Recordset. Specify field width = 12. EnumFields rst, 12以下示例显示雇员数以及平均薪水和最高薪水。Sub SelectX3() Count the number of employees, calculate the average salary, and return the highest salary.SELE

9、CT Count (*) AS TotalEmployees, Avg(Salary) AS AverageSalary, Max(Salary) AS MaximumSalary FROM Employees; Call EnumFields to print the contents of the Recordset. Pass the Recordset object and desired field width. EnumFields rst, 17调用过程向 Sub 过程 EnumFields 传递了一个 Recordset 对象。然后该过程设置 Recordset 的字段的格式并

10、将这些字段显示到调试窗口。intFldLen变量是需要的显示字段宽度。有些字段可能会被截断。Sub EnumFields(rst As Recordset, intFldLen As Integer) Dim lngRecords As Long, lngFields As Long Dim lngRecCount As Long, lngFldCount As Long Dim strTitle As String, strTemp As String Set the lngRecords variable to the number of records in the Recordset.

11、 lngRecords = rst.RecordCount Set the lngFields variable to the number of fields in the Recordset. lngFields = rst.Fields.Count Debug.Print There are lngRecords _ records containing lngFields _ fields in the recordset. Debug.Print Form a string to print the column heading. strTitle = Record For lngF

12、ldCount = 0 To lngFields - 1 strTitle = strTitle _ Left(rst.Fields(lngFldCount).Name _ Space(intFldLen), intFldLen) Next lngFldCount Print the column heading. Debug.Print strTitle Loop through the Recordset; print the record number and field values. rst.MoveFirst For lngRecCount = 0 To lngRecords - 1 Debug.Print Right(Space(6) & Str(lngRecCount), 6) &; Check for Null values. If IsNull(rst.F

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1