﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>数据库原理与应用 &#8211; 学术创新中心</title>
	<atom:link href="https://www.leexinghai.com/aic/category/gcc/1stls/dtba/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.leexinghai.com/aic</link>
	<description>Academic Innovation Center</description>
	<lastBuildDate>Wed, 21 Dec 2022 04:12:25 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.leexinghai.com/aic/wp-content/uploads/2025/08/cropped-徽标名称-32x32.jpg</url>
	<title>数据库原理与应用 &#8211; 学术创新中心</title>
	<link>https://www.leexinghai.com/aic</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>H21221-[超星]选择判断复习题12.29</title>
		<link>https://www.leexinghai.com/aic/cxexam/</link>
					<comments>https://www.leexinghai.com/aic/cxexam/#respond</comments>
		
		<dc:creator><![CDATA[李星海]]></dc:creator>
		<pubDate>Wed, 21 Dec 2022 04:12:25 +0000</pubDate>
				<category><![CDATA[数据库原理与应用]]></category>
		<guid isPermaLink="false">https://aic.leexinghai.com/?p=1672</guid>

					<description><![CDATA[写在前面：请您不要将本文进行扩散转发。因为这是我花了相当一段时间整理的结果。大家用过超星考试，也知道超星不能复 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-pullquote"><blockquote><p>写在前面：<strong>请您不要将本文进行扩散转发。</strong>因为这是我花了相当一段时间整理的结果。大家用过超星考试，也知道超星不能复制问题和答案出来，我是自己截了每道题的图片然后放到微信里面使用文字识别手动复制出来的。还是比较累的，所以希望您可以尊重一下我的劳动成果<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2665.png" alt="♥" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p><cite>整理和校对答案花了比较多的时间，不过因为个人能力还too young too simple，所以难免存在错误的答案或文本。<br>如果您有我的微信，且您找到了错误的地方，可以直接微信找我指出错误的题目。<br>如果您没有我的微信，请使用本文页脚的图标”星海网站找错“，在那里进行反馈。<br>反馈时可以留下您的真实姓名，我会放在这里作为特别贡献者。</cite></blockquote></figure>



<p>一、单选题</p>



<p>1.三级模式之间存在两种映射，它们是(A)。</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">模式与子模式间，模式与内模式间</mark></li>



<li>子模式与内模式间，外模式与内模式间</li>



<li>子模式与外模式间，模式与内模式间</li>



<li>模式与内模式间，模式与模式间</li>
</ul>



<p>2.(C)是长期存储在计算机内的有组织、可共享的数据集合。</p>



<ul class="wp-block-list">
<li>数据库管理系统</li>



<li>数据库系统</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">数据库</mark></li>



<li>文件组织</li>
</ul>



<p>3.SQL Server是一个基于(D)。</p>



<ul class="wp-block-list">
<li>层次模型的DBIS</li>



<li>网状模型的DBMS</li>



<li>关系模型的应用程序</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">关系模型的DBMS</mark></li>
</ul>



<p>4. 要保证数据库物理数据独立性，需要修改的是(B)。</p>



<ul class="wp-block-list">
<li>模式</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">模式与内模式的映射</mark></li>



<li>模式与外模式的映射</li>



<li>内模式</li>
</ul>



<p>5.下列四项中，不属于数据库特点的是(D)。</p>



<ul class="wp-block-list">
<li>数据共享</li>



<li>数据完整性</li>



<li>数据冗余较小</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">数据独立性低</mark></li>
</ul>



<p>6. 数据库系统的体系结构是(C)。</p>



<ul class="wp-block-list">
<li>两级模式结构和一级映像</li>



<li>三级模式结构和一级映像</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">三级模式结构和两级映像</mark></li>



<li>三级模式结构和三级映像</li>
</ul>



<p>7. 数据库系统不仅包括数据库本身，还要包括相应的硬件、软件和（D） 。</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-black-color">数据库管理系统</mark></li>



<li>数据库应用系统</li>



<li>相关的计算机系统</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">各类相关人员</mark>(已于21222完成校对)</li>
</ul>



<p>8. 在文件系统阶段，数据(B) 。</p>



<ul class="wp-block-list">
<li>无独立性</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">独立性差</mark></li>



<li>具有物理独立性</li>



<li>具有逻辑独立性</li>
</ul>



<p>9. 数据库系统阶段，数据(D)。</p>



<ul class="wp-block-list">
<li>具有物理独立性，没有逻辑独立性</li>



<li>具有物理独立性和逻辑独立性</li>



<li>独立性差</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">具有高度的物理独立性和一定程度的逻辑独立性</mark></li>
</ul>



<p>10.描述事物的符号记录称为(B)。</p>



<ul class="wp-block-list">
<li>信息</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">数据</mark></li>



<li>记录</li>



<li>记录集合</li>
</ul>



<p>11. (B)是位于用户与操作系统之间的一层数据库管理软件</p>



<ul class="wp-block-list">
<li>数据库系统</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">数据库管理系统</mark></li>



<li>数据库</li>



<li>数据库应用系统</li>
</ul>



<p>12. 下列四项中说法不正确的是( C)。</p>



<ul class="wp-block-list">
<li>数据库减少了数据冗余</li>



<li>数据库中的数据可以共享</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">数据库避免了一切数据的重复</mark></li>



<li>数据库具有较高的数据独立性</li>
</ul>



<p>13. 下列数据模型中，数据独立性最高的是( B)。</p>



<ul class="wp-block-list">
<li>网状数据模型</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">关系数据模型</mark></li>



<li>层次数据模型</li>



<li>非关系模型</li>
</ul>



<p>14.当前应用最广泛的数据模型是(B)</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-black-color">E-R模型</mark></li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">关系模型</mark>(已于21222完成校对)</li>



<li>网状模型</li>



<li>层次模型</li>
</ul>



<p>15. 反映现实世界中实体及实体间联系的信息模型是(D)。</p>



<ul class="wp-block-list">
<li>关系模型</li>



<li>层次模型</li>



<li>网状模型</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">E-R模型</mark></li>
</ul>



<p>16. 关系模型中，表示实体间n:联系是通过增加一个(A)</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">关系实现</mark></li>



<li>属性实现</li>



<li>关系或一个属性实现</li>



<li>关系和一个属性实现</li>
</ul>



<p>17. 在数据库设计中，将E-R图转换成关系数据模型的过程属于(B)</p>



<ul class="wp-block-list">
<li>需求分析阶段</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">逻辑设计阶段</mark></li>



<li>概念设计阶段</li>



<li>物理设计阶段</li>
</ul>



<p>18.数据模型的三要素是指(B)</p>



<ul class="wp-block-list">
<li>数据结构、数据对象和数据共享</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">数据结构、数据操作和数据完整性约束</mark></li>



<li>数据结构、数据操作和数据的安全控制</li>



<li>数据结构、数据操作和数据的可靠性</li>
</ul>



<p>19.下列数据模型中，数据独立性最高的是(B)</p>



<ul class="wp-block-list">
<li>网状数据模型</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">关系数据模型</mark></li>



<li>层次数据模型</li>



<li>非关系模型</li>
</ul>



<p>20.E-R模型属于 (A)</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">信息模型</mark>(已于21222完成校对)</li>



<li>层次模型</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-black-color">关系模型</mark></li>



<li>网状模型</li>
</ul>



<p>21. (B)属于信息世界的模型，是现实世界到机器世界的一个中间层次。</p>



<ul class="wp-block-list">
<li>数据模型</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">概念模型</mark></li>



<li>E-图</li>



<li>关系模型</li>
</ul>



<p>22. 概念结构设计阶段得到的结果是(B)。</p>



<ul class="wp-block-list">
<li>数据字典描述的数据需求</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">E-R图表示的概念模型</mark></li>



<li>某个DBMS所支持的数据模型</li>



<li>包括存储结构和存取方法的物理结构</li>
</ul>



<p>23. 一个m:n联系转换为一个关系模式。关系的码为(B)</p>



<ul class="wp-block-list">
<li>某个实体的码</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">各实体码的组合</mark></li>



<li>N端实体的码</li>



<li>任意一个实体的码</li>
</ul>



<p>24. 如果对于实体集A中的每一个实体，实体集B中有n个实体与之联系；对于实体集B中的每一个实体，实体集A中至多有一个实体与之联系，称实体集A与B的联系为(A)</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">A．1:1联系</mark></li>



<li>B．1:n联系</li>



<li>C．n:m联系</li>



<li>D．多种联系</li>
</ul>



<p>25.公司中有多个部门和多名职员，每个职员只能属于一个部门，一个部门可以有多名职员，从职员到部门的联系类型是(C)</p>



<ul class="wp-block-list">
<li>多对多</li>



<li>一对一</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">多对一</mark></li>



<li>一对多</li>
</ul>



<p>26. 12个实体类型，并且它们之间存在着15个不同的二元联系，其中4个是1:1联系类型，5个是1:N联系类型，6个M:N联系类型，那么根据转换规则，这个ER结构转换成的关系模式有（B）</p>



<ul class="wp-block-list">
<li>17个</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">18个</mark></li>



<li>23个</li>



<li>27个</li>
</ul>



<p>27.现有一个关系：借阅（书号、书名，库存数，读者号，借期，还期），假如同一本书允许一个读者多次借阅，但不能同时对一种书借多本。则该关系模式的码是（D）。</p>



<ul class="wp-block-list">
<li>书号</li>



<li>读者号</li>



<li>书号+读者号</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">书号+读者号+借期</mark></li>
</ul>



<p>28. SQL语言是(B)的语言，容易学习</p>



<ul class="wp-block-list">
<li>过程化</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">非过程化</mark></li>



<li>格式化</li>



<li>导航式</li>
</ul>



<p>29. SQL语言的数据操纵语句包括Select,Insert,Update,Delete等。其中最重要的，也是使用最频繁的语句是(A)</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">Select</mark></li>



<li>Insert</li>



<li>Update</li>



<li>Delete</li>
</ul>



<p>30.在视图上不能完成的操作是(C)。</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-black-color">更新视图</mark></li>



<li>查询</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">在视图上定义新的表</mark></li>



<li>在视图上定义新的视图</li>
</ul>



<p>31.SQL语言集数据查询，数据操纵，数据定义和数据控制功能于一体，其中，Create,Drop,A1ter语句可实现哪种功能(C)？</p>



<ul class="wp-block-list">
<li>数据查询</li>



<li>数据操纵</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">数据定义</mark></li>



<li>数据控制</li>
</ul>



<p>32. SQL语言中，删除一个视图的命令是( B)</p>



<ul class="wp-block-list">
<li>Delete</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">Drop</mark></li>



<li>Clear</li>



<li>Remove</li>
</ul>



<p>33.在SQL语言中的视图View是数据库的(A)。</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">外模式</mark></li>



<li>模式</li>



<li>内模式</li>



<li>存储模式</li>
</ul>



<p>34.下列的SQL语句中， (D)不是数据定义语句</p>



<ul class="wp-block-list">
<li>create table</li>



<li>drop view</li>



<li>oreate yiew</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">grant</mark></li>
</ul>



<p>35.若要撤销数据库中已经存在的表S，可用( A)</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">delete table S</mark></li>



<li>drop view</li>



<li>create table S</li>



<li>drop s</li>
</ul>



<p>36.若要在基本表S中增加一列CN(课程名)，可用(C)。</p>



<ul class="wp-block-list">
<li>add table S CN char(8)</li>



<li>Badd table S alter CN char(8)</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">alter table S add CN char(8)</mark></li>



<li>alter table S add CN varchar(8)</li>
</ul>



<p>37.学生关系模式S,(S#,Sname,Sex,Age),S的属性分别表示学号，姓名，性别，年龄。要在S中删除一个属性“年龄”可选用的SQL语句是(B)</p>



<ul class="wp-block-list">
<li>delete Age from S</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">alter table S drop Age</mark></li>



<li>update S Age</li>



<li>alter table S Age</li>
</ul>



<p>38.DBS是采用了数据库技术的计算机系统DBS是一个集合体,包含数据库,计算机硬件软件和(C)</p>



<ul class="wp-block-list">
<li>系统分析员</li>



<li>程序员</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">数据库管理员</mark></li>



<li>操作员</li>
</ul>



<p>39. 数据库(DB)，数据库系统(DBS)和数据库管理系统(DBMS)之间的关系是(A)</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">DBS包括DB和DBMS</mark></li>



<li>DBMS包括DB和DBS</li>



<li>DB包括DBS和DBMS</li>



<li>DBS就是DB也就是DBMS</li>
</ul>



<p>40.下面列出的数据库管理技术发展的三个阶段中,没有专门的软件对数据进行管理的是(A).</p>



<p>1人工管理阶段，2.文件系统阶段，3.数据库阶段</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">I和2</mark></li>



<li>只有2</li>



<li>2和 3</li>



<li>只有 I</li>
</ul>



<p>41.下列四项中,不属于数据库系统特点的是(B)</p>



<ul class="wp-block-list">
<li>数据共享</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">数据完整性</mark></li>



<li>数据冗余度高</li>



<li>数据独立性高</li>
</ul>



<p>42. 数据库系统的数据独立性体现在(B)</p>



<ul class="wp-block-list">
<li>不会因为数据的变化而影响到应用程序</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">不会因为系统数据存储结构与数据逻辑结构的变化而影响应用程序</mark></li>



<li>不会因为存储策略的变化而影响存储结构</li>



<li>不会因为某些存储结构的变化而影响其他的存储结构</li>
</ul>



<p>43. 描述数据库全体数据的全局逻辑结构和特性的是(A)</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">模式</mark></li>



<li>内模式</li>



<li>外模式</li>



<li>用户模式</li>
</ul>



<p>44.要保证数据库的数据独立性,需要修改的是(A)</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">模式与外模式</mark></li>



<li>模式与内模式</li>



<li>三层之间的两种映射</li>



<li>三层模式</li>
</ul>



<p>45. 要保证数据库的逻辑数据独立性,需要修改的是(A)</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">模式与外模式的映射</mark></li>



<li>模式与内模式之间的映射</li>



<li>模式</li>



<li>三层模式</li>
</ul>



<p>46.用户或应用程序看到的那部分局部逻辑结构和特征的描述是(C)它是模式的逻辑子集</p>



<ul class="wp-block-list">
<li>模式</li>



<li>物理模式</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">子模式</mark></li>



<li>内模式</li>
</ul>



<p>47 下述(D)不是DBA数据库管理员的职责</p>



<ul class="wp-block-list">
<li>完整性约束说明</li>



<li>定义数据库模式</li>



<li>数据库安全</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">数据库管理系统设计</mark></li>
</ul>



<p>48. 下面的选项不是关系数据库基本特征的是(A)</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">不同的列应有不同的数据类型</mark></li>



<li>不同的列应有不同的列名</li>



<li>与行的次序无关</li>



<li>与列的次序无关</li>
</ul>



<p>49.一个关系只有一个(D)</p>



<ul class="wp-block-list">
<li>候选码</li>



<li>外码</li>



<li>超码</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">主码</mark></li>
</ul>



<p>50. 关系模型中,一个码是(C)</p>



<ul class="wp-block-list">
<li>可以由多个任意属性组成</li>



<li>至多由一个属性组成</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">可有多个或者一个其值能够唯一表示该关系模式中任何元组的属性组成</mark></li>



<li>以上都不是</li>
</ul>



<p>51.关系代数运算是以(C)为基础的运算。</p>



<ul class="wp-block-list">
<li>关系运算</li>



<li>谓词演算</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">集合运算</mark></li>



<li>代数运算</li>
</ul>



<p>52. 关系数据库管理系统应能实现的专门关系运算包括(B)</p>



<ul class="wp-block-list">
<li>排序索引统计</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">选择.投影,连接</mark></li>



<li>关联.更新,排序</li>



<li>显示,打印,制表</li>
</ul>



<p>53.五种基本关系代数运算是(下列均为答案)。</p>



<p><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">∪，-，×，π和σ</mark></p>



<p>54. 关系数据库中的投影操作是指从关系中(B)。</p>



<ul class="wp-block-list">
<li>抽出特定记录</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">抽出特定字段</mark></li>



<li>建立相应的影像</li>



<li>建立相应的图形</li>
</ul>



<p>55. 从一个数据库文件中取出满足某个条件的所有记录形成一个新的数据库文件的操作是(A)操作</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">投影</mark></li>



<li>联接</li>



<li>选择</li>



<li>复制</li>
</ul>



<p>56自然联接是构成新关系的有效方法一般情况下,当对关系R和S是用自然联接时要求R和S含有一个或者多个共有的(C)</p>



<ul class="wp-block-list">
<li>记录</li>



<li>行</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">属性</mark></li>



<li>元组</li>
</ul>



<p>57. 关系代数中的连联接操作是由(B)操作组合而成</p>



<ul class="wp-block-list">
<li>选择和投影</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">选择和笛卡尔积</mark></li>



<li>投影,选择,笛卡尔积</li>



<li>投影和笛卡尔积</li>
</ul>



<p>58假设有关系R和S.在下列的关系运算中(D)运算不要求:"R和S具有相同的元数,目它们的对应属性的数据类型也相同”</p>



<ul class="wp-block-list">
<li>R∩S</li>



<li>RUS</li>



<li>R-S</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">RxS</mark></li>
</ul>



<p>59. 假设有关系R和S.关系代数表达式R-(R-S)表示的是(A)</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">R∩S</mark></li>



<li>RUS</li>



<li>R-S</li>



<li>RxS</li>
</ul>



<p>60. 如何构造出一个合适的数据逻辑结构是(C)主要解决的问题</p>



<ul class="wp-block-list">
<li>关系系统查询优化</li>



<li>数据字典</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">关系数据库规范化F理论</mark></li>



<li>关系数据库查询</li>
</ul>



<p>二、多选题</p>



<p>数据库管理技术经历了哪些阶段?(ABD)</p>



<ul class="wp-block-list">
<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">人工管理</mark></li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">文件系统</mark></li>



<li>网状系统</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">数据库系统</mark></li>
</ul>



<p>三、填空题</p>



<p>1.在关系数据库规范化理论的研究中，在函数依赖的范畴内，[<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">BC</mark>]范式达到了最高的规范化程度</p>



<p>2.在关系数据库的规范化理论中，在执行“分解”时，必须遵守规范化原则:保持原有的函数依赖和[<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">无损分解</mark>]</p>



<p>3.如果一个关系模式R是1DF，并且关系的每个决定因子都是候选码，那么R至少应该是[<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">BC</mark>]范式</p>



<p>4.设关系模式R (A，B，C，D)，函数依赖集F= AB->C，DB}，则R的候选码为[<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">ACD</mark>]</p>



<p>5.从关系规范化理论的角度讲，一个只满足1EF的关系可能存在的四方面问题是:数据几余度大、插入异常、[<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">更新异常</mark>]和删除异常</p>



<p>四、判断题</p>



<p>在SQL语言中的视图VIEW是数据库的模式[<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">√</mark>]</p>



<p>投影运算结果的元组数目和原来的关系一样多。[<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">x</mark>]</p>



<p>在数据库设计中，将E-R图转换成关系数据模型的过程属于概念设计阶段[<mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">×</mark>]</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.leexinghai.com/aic/cxexam/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>H21121-E-R图绘制</title>
		<link>https://www.leexinghai.com/aic/h21121-e-r%e5%9b%be%e7%bb%98%e5%88%b6/</link>
					<comments>https://www.leexinghai.com/aic/h21121-e-r%e5%9b%be%e7%bb%98%e5%88%b6/#respond</comments>
		
		<dc:creator><![CDATA[李星海]]></dc:creator>
		<pubDate>Tue, 22 Nov 2022 07:10:52 +0000</pubDate>
				<category><![CDATA[数据库原理与应用]]></category>
		<guid isPermaLink="false">https://aic.leexinghai.com/?p=1514</guid>

					<description><![CDATA[作业：完成课本161-163页E-R图绘制]]></description>
										<content:encoded><![CDATA[
<p>作业：完成课本161-163页E-R图绘制</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img fetchpriority="high" decoding="async" width="730" height="393" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-104.png" alt="" class="wp-image-1515" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-104.png 730w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-104-300x162.png 300w" sizes="(max-width: 730px) 100vw, 730px" /><figcaption class="wp-element-caption">图1验证注册子系统模块的局部E-R图</figcaption></figure>
</div>


<p></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="865" height="330" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-105.png" alt="" class="wp-image-1516" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-105.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-105-300x114.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-105-768x293.png 768w" sizes="(max-width: 865px) 100vw, 865px" /><figcaption class="wp-element-caption">图2招聘及应聘子系统模块的局部E-R图</figcaption></figure>
</div>


<p></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="865" height="411" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-106.png" alt="" class="wp-image-1517" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-106.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-106-300x143.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-106-768x365.png 768w" sizes="(max-width: 865px) 100vw, 865px" /><figcaption class="wp-element-caption">图3就业服务系统管理子系统模块的局部E-R图</figcaption></figure>
</div>


<p></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="500" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-107.png" alt="" class="wp-image-1518" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-107.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-107-300x173.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-107-768x444.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption class="wp-element-caption">图4高校毕业生就业服务系统全局E-R图</figcaption></figure>
</div>]]></content:encoded>
					
					<wfw:commentRss>https://www.leexinghai.com/aic/h21121-e-r%e5%9b%be%e7%bb%98%e5%88%b6/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>H21114-课后练习1-121页二1-4</title>
		<link>https://www.leexinghai.com/aic/h21114-%e8%af%be%e5%90%8e%e7%bb%83%e4%b9%a01-121%e9%a1%b5%e4%ba%8c1-4/</link>
					<comments>https://www.leexinghai.com/aic/h21114-%e8%af%be%e5%90%8e%e7%bb%83%e4%b9%a01-121%e9%a1%b5%e4%ba%8c1-4/#respond</comments>
		
		<dc:creator><![CDATA[李星海]]></dc:creator>
		<pubDate>Tue, 15 Nov 2022 08:23:18 +0000</pubDate>
				<category><![CDATA[数据库原理与应用]]></category>
		<guid isPermaLink="false">https://aic.leexinghai.com/?p=1444</guid>

					<description><![CDATA[1.李明在哪些课程得到的分数超过80？列出课程名 select cname from C join SC on [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>1.李明在哪些课程得到的分数超过80？列出课程名</p>



<p>select cname from C join SC on SC.cno=C.cno join S on S.sno=SC.sno and SC.score&gt;’80’</p>



<p>where S.sname='李明'</p>



<p>2.列出没有选修“人工智能”课程的学生姓名、年龄。</p>



<p>select sname,sage from S where sno not in</p>



<p>(select sno from SC where cno&nbsp; in(select cno from C where cname='人工智能'))</p>



<p>3.哪些学生“数据库”课程的成绩要高于王红的数据库？列出学号、姓名。</p>



<p>select S.sno,sname from S</p>



<p>join SC on S.sno=SC.sno join C on SC.cno=C.cno and cname='数据库' and SC.score&gt;( select score from SC</p>



<p>join S on S.sno=SC.sno join C on SC.cno=C.cno and cname='数据库'</p>



<p>where sname='王红')</p>



<p>4.列出王风老师教的每门课程的最高分。</p>



<p>select SC.cno,max(score),C.cname from SC join C on SC.cno=C.cno join T on C.tno=T.tno and T.tname='王风'</p>



<p>group by SC.cno,C.cname</p>



<p>4.列出王风老师教的每门课程的最高分。</p>



<p><code>select sc.cno,max(score),course.cname from sc join course on sc.cno=course.cno join teacher on course.tno=teacher.tno and teacher.tname='王风' group by sc.cno,course.cname</code></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.leexinghai.com/aic/h21114-%e8%af%be%e5%90%8e%e7%bb%83%e4%b9%a01-121%e9%a1%b5%e4%ba%8c1-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>H21107-随堂练习1</title>
		<link>https://www.leexinghai.com/aic/h21107-%e9%9a%8f%e5%a0%82%e7%bb%83%e4%b9%a01/</link>
					<comments>https://www.leexinghai.com/aic/h21107-%e9%9a%8f%e5%a0%82%e7%bb%83%e4%b9%a01/#respond</comments>
		
		<dc:creator><![CDATA[李星海]]></dc:creator>
		<pubDate>Tue, 08 Nov 2022 00:55:56 +0000</pubDate>
				<category><![CDATA[数据库原理与应用]]></category>
		<guid isPermaLink="false">https://aic.leexinghai.com/?p=1396</guid>

					<description><![CDATA[例14 查询选修了课程名为“信息系统”的学生学号和姓名. select Sno,Sname from Stud [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><strong>例14 查询选修了课程名为“信息系统”的学生学号和姓名.</strong></p>



<p>select Sno,Sname</p>



<p>from Student</p>



<p>where Sno in (</p>



<p>&nbsp;&nbsp;&nbsp; select Sno from SC where Cno IN (</p>



<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select Cno from Course where Cname='信息系统'</p>



<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )</p>



<p>&nbsp;&nbsp;&nbsp; );</p>



<p><strong>例17 查询考试平均成绩高于全体学生的总平均成绩的学生学号和平均成绩</strong></p>



<p>select Sno,avg(Grade)as '平均成绩'</p>



<p>from SC</p>



<p>group by Sno</p>



<p>having avg(Grade)&gt;(select avg(Grade) from SC)</p>



<p><strong>例21 查询所有学习了1号课程的学号和姓名</strong></p>



<p>select Sno,Sname</p>



<p>from Student</p>



<p>where Sno in(select Sno from SC where Cno='1')</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.leexinghai.com/aic/h21107-%e9%9a%8f%e5%a0%82%e7%bb%83%e4%b9%a01/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>H21102D-实验5-数据查询的操作(二)</title>
		<link>https://www.leexinghai.com/aic/h21106-%e5%ae%9e%e9%aa%8c5-%e6%95%b0%e6%8d%ae%e6%9f%a5%e8%af%a2%e7%9a%84%e6%93%8d%e4%bd%9c%e4%ba%8c/</link>
					<comments>https://www.leexinghai.com/aic/h21106-%e5%ae%9e%e9%aa%8c5-%e6%95%b0%e6%8d%ae%e6%9f%a5%e8%af%a2%e7%9a%84%e6%93%8d%e4%bd%9c%e4%ba%8c/#respond</comments>
		
		<dc:creator><![CDATA[李星海]]></dc:creator>
		<pubDate>Sun, 06 Nov 2022 07:00:03 +0000</pubDate>
				<category><![CDATA[数据库原理与应用]]></category>
		<guid isPermaLink="false">https://aic.leexinghai.com/?p=1314</guid>

					<description><![CDATA[一、实验目的 通过本实验，使读者学会SQL语言SELECT语句的查询操作，熟练掌握两个或两个以上的表的基本的连 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><strong>一、实验目的</strong></p>



<p>通过本实验，使读者学会SQL语言SELECT语句的查询操作，熟练掌握两个或两个以上的表的基本的连接操作，区分内连接与外连接的特点，学会应用自连接进行查询，会给表命别名。</p>



<p><strong>二、实验仪器设备、试剂或材料</strong><strong></strong></p>



<p>使用SQL Server 2008软件进行实验操作。</p>



<p><strong>三、实验要求</strong><strong></strong></p>



<p><strong>&nbsp;&nbsp;</strong>&nbsp; 创建一个名为lianxi2的数据库，在该数据库中导入仓库表、职工表、订购表和供应商表，并完成指定的查询操作，熟练掌握两个以上的表的内连接查询、左连接查询、右连接查询、外连接查询。</p>



<p><strong>四、实验内容与步骤</strong><strong></strong></p>



<p><strong>1</strong><strong>、创建仓库表</strong></p>



<p><strong>2</strong><strong>、创建职工表</strong></p>



<p><strong>3</strong><strong>、创建订购表</strong></p>



<p><strong>4、创建供应商表</strong></p>



<h2 class="wp-block-heading"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-pale-pink-color">上述四个表可以在文末下载。</mark></em></h2>



<p><strong>5</strong><strong>、用SQL语句完成以下查询</strong></p>



<p><strong>（1）、查询每个城市的仓库总面积；如图1所示。</strong></p>



<p><code>select [城市],sum([面积（㎡）]) as"总面积"</code> <code>from [仓库表] group by [城市]</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="545" height="573" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-44.png" alt="" class="wp-image-1365" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-44.png 545w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-44-285x300.png 285w" sizes="auto, (max-width: 545px) 100vw, 545px" /><figcaption class="wp-element-caption">图1</figcaption></figure>
</div>


<p><strong>（2）、查询每个仓库的职工人数，如果该仓库没有职工，也要列出人数为0（用左外连接实现）；如图2所示。</strong></p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">
<p><code>select [仓库表].仓库号,count([职工号])as"职工人数", sum([面积（㎡）]) as"总面积"</code></p>



<p><code>from [仓库表] left join [职工表] on&nbsp; [仓库表].仓库号=[职工表].仓库号</code></p>



<p><code>group by</code></p>



<p><code>[仓库表].仓库号</code></p>
</div></div>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="588" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-45.png" alt="" class="wp-image-1366" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-45.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-45-300x204.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-45-768x522.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption class="wp-element-caption">图2</figcaption></figure>
</div>


<p><strong>（3）、查询在上海工作的职工有多少个；如图3所示。</strong></p>



<p><code>select count(职工号) as "在上海工作的职工人数"</code></p>



<p><code>from 仓库表 join 职工表 on 仓库表.[仓库号]=职工表.[仓库号]</code></p>



<p><code>where [城市]='上海'</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="685" height="493" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-46.png" alt="" class="wp-image-1367" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-46.png 685w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-46-300x216.png 300w" sizes="auto, (max-width: 685px) 100vw, 685px" /><figcaption class="wp-element-caption">图3</figcaption></figure>
</div>


<p><strong>（4）、查询哪些职工在上海工作，列出他们的职工号、仓库号；如图4所示。</strong></p>



<p><code>select 职工号,[仓库表].仓库号</code></p>



<p><code>from 仓库表 join 职工表 on 仓库表.[仓库号]=职工表.[仓库号]</code></p>



<p><code>where [城市]='上海'</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="669" height="569" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-47.png" alt="" class="wp-image-1368" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-47.png 669w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-47-300x255.png 300w" sizes="auto, (max-width: 669px) 100vw, 669px" /><figcaption class="wp-element-caption">图4</figcaption></figure>
</div>


<p><strong>（5）、查询与E3号职工有订购业务联系的供应商、供应商号；如图5所示。</strong></p>



<p><code>select 供应商表.供应商号,供应商名</code></p>



<p><code>from 订购表 join 供应商表 on 订购表.[供应商号]=供应商表.[供应商号]</code></p>



<p><code>where [职工号]='E3'</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="784" height="542" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-48.png" alt="" class="wp-image-1369" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-48.png 784w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-48-300x207.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-48-768x531.png 768w" sizes="auto, (max-width: 784px) 100vw, 784px" /><figcaption class="wp-element-caption">图5</figcaption></figure>
</div>


<p><strong>（6）、查询哪些职工与爱华电子厂有订购业务联系，列出他们的职工号、仓库号；如图6所示。</strong></p>



<p><code>select 职工表.职工号,仓库号</code></p>



<p><code>from 订购表 join 供应商表 on 订购表.[供应商号]=供应商表.[供应商号]</code></p>



<p><code>join 职工表 on 订购表.职工号=职工表.职工号</code></p>



<p><code>where [供应商名]='爱华电子厂'</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="775" height="530" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-49.png" alt="" class="wp-image-1370" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-49.png 775w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-49-300x205.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-49-768x525.png 768w" sizes="auto, (max-width: 775px) 100vw, 775px" /><figcaption class="wp-element-caption">图6</figcaption></figure>
</div>


<p><strong>（7）、查询每个供应商的订购单数量，列出供应商号和他们的订购单数量；如图7所示。</strong></p>



<p><code>select 供应商表.供应商号,count(*) as"订购单数量"</code></p>



<p><code>from 订购表 join 供应商表 on 订购表.[供应商号]=供应商表.[供应商号]</code></p>



<p><code>group by 供应商表.供应商号</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="826" height="580" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-52.png" alt="" class="wp-image-1373" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-52.png 826w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-52-300x211.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-52-768x539.png 768w" sizes="auto, (max-width: 826px) 100vw, 826px" /><figcaption class="wp-element-caption">图7</figcaption></figure>
</div>


<p><strong>（8）、查询月工资在3000元以上，并在北京或上海工作的职工，列出他们的职工号和月工资；如图8所示。</strong></p>



<p><code>select 职工表.职工号,职工表.[月工资（元）]</code></p>



<p><code>from 职工表 join 仓库表 on 仓库表.仓库号=职工表.仓库号</code></p>



<p><code>where(城市='上海'or 城市='北京') and [月工资（元）]>3000</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="727" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-51.png" alt="" class="wp-image-1372" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-51.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-51-300x252.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-51-768x645.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption class="wp-element-caption">图8</figcaption></figure>
</div>


<p><strong>（9）、查询与供应商号为S3的供应商有业务联系的职工，求出这些职工的职工号、订购单号、仓库号、城市；如图9所示。</strong></p>



<p><code>select 职工表.职工号,订购单号,仓库表.仓库号,城市</code></p>



<p><code>from 订购表 join 供应商表 on 订购表.供应商号=供应商表.供应商号</code></p>



<p><code>join 职工表 on 订购表.职工号=职工表.职工号</code></p>



<p><code>join 仓库表 on 仓库表.仓库号=职工表.仓库号</code></p>



<p><code>where 供应商表.供应商号='S3'</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="609" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-53.png" alt="" class="wp-image-1374" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-53.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-53-300x211.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-53-768x541.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption class="wp-element-caption">图9</figcaption></figure>
</div>


<p><strong>（10）、查询出哪些仓库没有分配职工，列出对应的仓库号；如图10所示。</strong></p>



<p><code>select 仓库表.仓库号</code></p>



<p><code>from 仓库表 left join 职工表 on 仓库表.仓库号=职工表.仓库号</code></p>



<p><code>where 职工表.职工号 is null</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="628" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-54.png" alt="" class="wp-image-1375" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-54.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-54-300x218.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-54-768x558.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption class="wp-element-caption">图10</figcaption></figure>
</div>


<p><strong>（11）、查询出哪些职工的工资高于全体职工平均工资，列出职工号、仓库号、月工资；如图11所示。</strong></p>



<p><code>select 职工号,仓库号,[月工资（元）]</code></p>



<p><code>from  职工表</code></p>



<p><code>where [月工资（元）]>(select AVG([月工资（元）])from 职工表)</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="696" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-55.png" alt="" class="wp-image-1376" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-55.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-55-300x241.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-55-768x618.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption class="wp-element-caption">图11</figcaption></figure>
</div>


<p><strong>（12）、查询出哪些职工的工资高于他所在仓库的职工的平均工资，列出职工号、仓库号、月工资。如图12所示。</strong></p>



<p><code>select 职工号,仓库号,[月工资（元）]</code></p>



<p><code>from  职工表 S1</code></p>



<p><code>where [月工资（元）]>(select AVG([月工资（元）])from 职工表 S2 where S1.仓库号=S2.仓库号)</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="453" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-56.png" alt="" class="wp-image-1377" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-56.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-56-300x157.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-56-768x402.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption class="wp-element-caption">图12</figcaption></figure>
</div>


<p><strong>五、实验结果与分析</strong><strong></strong></p>



<p>通过本实验，学会SQL语言SELECT语句的查询操作，熟练掌握两个或两个以上的表的基本的连接操作，区分内连接与外连接的特点，学会自连接查询，会给表命别名。</p>



<p><strong>六、结论与体会</strong><strong></strong></p>



<p>&nbsp; 掌握两个或两个以上的表的基本的连接操作，区分内连接与外连接的特点，自连接查询和给表命别名。</p>



<p><strong>七、教师评语</strong><strong></strong></p>



<h2 class="wp-block-heading"><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-pale-pink-color">重要提示</mark></h2>



<p>本实验用到的数据库(点击即可下载)：</p>



<div class="wp-block-file"><a id="wp-block-file--media-2e6f2d9b-f458-4241-b356-0e2c5b07bb7c" href="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/实验用表.7z"><strong>实验用表</strong></a></div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.leexinghai.com/aic/h21106-%e5%ae%9e%e9%aa%8c5-%e6%95%b0%e6%8d%ae%e6%9f%a5%e8%af%a2%e7%9a%84%e6%93%8d%e4%bd%9c%e4%ba%8c/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>H21031-表的逻辑作业</title>
		<link>https://www.leexinghai.com/aic/h21031-%e8%a1%a8%e7%9a%84%e9%80%bb%e8%be%91%e4%bd%9c%e4%b8%9a/</link>
					<comments>https://www.leexinghai.com/aic/h21031-%e8%a1%a8%e7%9a%84%e9%80%bb%e8%be%91%e4%bd%9c%e4%b8%9a/#respond</comments>
		
		<dc:creator><![CDATA[李星海]]></dc:creator>
		<pubDate>Tue, 01 Nov 2022 01:07:15 +0000</pubDate>
				<category><![CDATA[数据库原理与应用]]></category>
		<guid isPermaLink="false">https://aic.leexinghai.com/?p=1281</guid>

					<description><![CDATA[完成四张excel表，分别是笛卡尔积表、内连接表、左连接表、右连接表。 1.笛卡尔积表查询代码select S [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><strong>完成四张excel表，分别是笛卡尔积表、内连接表、左连接表、右连接表。</strong></p>



<p>1.笛卡尔积表查询代码<br><code>select Student.Sno,Sname,Ssex,Sage,Sdept, SC.Sno,Cno,Grade<br>from Student cross join SC;</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="587" height="545" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-21.png" alt="" class="wp-image-1293" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-21.png 587w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-21-300x279.png 300w" sizes="auto, (max-width: 587px) 100vw, 587px" /><figcaption>笛卡尔积参考结果（部分）</figcaption></figure>
</div>


<p><br>2.内连接查询代码<br><code>select Student.Sno,Sname,Ssex,Sage,Sdept, SC.Sno,Cno,Grade<br>from Student inner join SC on SC.Sno=Student.Sno;</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="585" height="289" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-20.png" alt="" class="wp-image-1292" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-20.png 585w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-20-300x148.png 300w" sizes="auto, (max-width: 585px) 100vw, 585px" /><figcaption>内连接参考结果</figcaption></figure>
</div>


<p><br>3.左连接查询代码<br><code>select Student.Sno,Sname,Ssex,Sage,Sdept, SC.Sno,Cno,Grade<br>from Student left join SC on SC.Sno=Student.Sno;</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="588" height="391" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-18.png" alt="" class="wp-image-1289" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-18.png 588w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-18-300x199.png 300w" sizes="auto, (max-width: 588px) 100vw, 588px" /><figcaption>左连接参考结果</figcaption></figure>
</div>


<p><br>4.右连接查询代码<br><code>select Student.Sno,Sname,Ssex,Sage,Sdept, SC.Sno,Cno,Grade<br>from Student right join SC on SC.Sno=Student.Sno;</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-19.png" alt="" class="wp-image-1291" width="583" height="296" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-19.png 583w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-19-300x152.png 300w" sizes="auto, (max-width: 583px) 100vw, 583px" /><figcaption>右连接参考结果</figcaption></figure>
</div>


<h2 class="wp-block-heading">将查询结果导入到excel表格的方法：</h2>



<p>1.先在结果框右键全选（也可以直接按CTRL+A）</p>



<p>2.再按一次右键，选择“连同标题一起复制”</p>



<p>3.CTRL+V粘贴到EXCEL表格的第一个单元格即可</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-26.png" alt="" class="wp-image-1309" width="825" height="302" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-26.png 825w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-26-300x110.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/11/image-26-768x281.png 768w" sizes="auto, (max-width: 825px) 100vw, 825px" /><figcaption>导出数据操作图解</figcaption></figure>
</div>


<p>配套数据库（文件）：</p>



<div class="wp-block-file"><a id="wp-block-file--media-6da8ac4d-a112-4ca6-a550-c26ca6992557" href="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/Student表.xls">Student表</a><a href="https://www.leexinghai.com/aic/wp-content/uploads/2022/11/Student表.xls" class="wp-block-file__button" download aria-describedby="wp-block-file--media-6da8ac4d-a112-4ca6-a550-c26ca6992557">下载</a></div>



<p><br></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.leexinghai.com/aic/h21031-%e8%a1%a8%e7%9a%84%e9%80%bb%e8%be%91%e4%bd%9c%e4%b8%9a/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>H21026-实验4-数据查询的操作（一）</title>
		<link>https://www.leexinghai.com/aic/h21026-%e5%ae%9e%e9%aa%8c4-%e6%95%b0%e6%8d%ae%e6%9f%a5%e8%af%a2%e7%9a%84%e6%93%8d%e4%bd%9c%ef%bc%88%e4%b8%80%ef%bc%89/</link>
					<comments>https://www.leexinghai.com/aic/h21026-%e5%ae%9e%e9%aa%8c4-%e6%95%b0%e6%8d%ae%e6%9f%a5%e8%af%a2%e7%9a%84%e6%93%8d%e4%bd%9c%ef%bc%88%e4%b8%80%ef%bc%89/#respond</comments>
		
		<dc:creator><![CDATA[李星海]]></dc:creator>
		<pubDate>Wed, 26 Oct 2022 02:58:28 +0000</pubDate>
				<category><![CDATA[数据库原理与应用]]></category>
		<guid isPermaLink="false">https://aic.leexinghai.com/?p=1175</guid>

					<description><![CDATA[一、实验目的 &#160;&#160;&#160; 通过本实验，使读者学会SQL语言SELECT语句的基本使用 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>一、<strong>实验目的</strong></p>



<p><strong>&nbsp;&nbsp;&nbsp; </strong><strong>通过本实验，使读者学会SQL语言SELECT语句的基本使用方法，熟练掌握单表查询、分组查询、聚集函数查询和查询结果排序，学会数据的导入与导出的方法。</strong></p>



<p><strong>二、实验仪器设备、试剂或材料</strong><strong></strong></p>



<p><strong>使用</strong><strong>SQL Server 2008</strong><strong>软件进行实验操作。</strong><strong></strong></p>



<ul class="wp-block-list"><li><strong>实验要求</strong></li></ul>



<p><strong>&nbsp;&nbsp;&nbsp; </strong><strong>创建一个名为lianxi1的数据库，在该数据库中导入仓库表和职工表。完成指定的查询操作，熟练掌握单表的全部查询、指定列查询、取消重复行查询、加别名查询、满足给定条件的查询、分组查询、聚集函数查询、结果排序等查询。</strong></p>



<p><strong>四、实验内容与步骤</strong></p>



<ol class="wp-block-list" type="1"><li><strong>创建仓库表，首先创建数据库[lianxi1],如图1所示。</strong></li></ol>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="800" height="702" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-85.png" alt="" class="wp-image-1185" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-85.png 800w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-85-300x263.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-85-768x674.png 768w" sizes="auto, (max-width: 800px) 100vw, 800px" /><figcaption>图1</figcaption></figure>
</div>


<p><strong>1.1</strong><strong>完成创建后，在数据库位置右键</strong><strong>“</strong><strong>任务</strong><strong>”</strong><strong>-&gt;</strong><strong>导入数据，数据源中选择</strong><strong>“</strong><strong>Microsoft Excel</strong><strong>”</strong><strong>，如图2所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="805" height="597" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-86.png" alt="" class="wp-image-1186" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-86.png 805w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-86-300x222.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-86-768x570.png 768w" sizes="auto, (max-width: 805px) 100vw, 805px" /><figcaption>图2</figcaption></figure>
</div>


<p><strong>1.2</strong><strong>目标选择</strong><strong>“</strong><strong>SQLSNC11.0</strong><strong>”</strong><strong>如图3所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="708" height="621" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-87.png" alt="" class="wp-image-1187" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-87.png 708w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-87-300x263.png 300w" sizes="auto, (max-width: 708px) 100vw, 708px" /><figcaption>图3</figcaption></figure>
</div>


<p><strong>1.3</strong><strong>在下一步的</strong><strong>“</strong><strong>目标</strong><strong>”</strong><strong>将[dbo].[***]修改为“仓库表”。如图4所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="759" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-88.png" alt="" class="wp-image-1189" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-88.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-88-300x263.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-88-768x674.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图4</figcaption></figure>
</div>


<ul class="wp-block-list"><li><strong>创建职工表，步骤可以参考第一步。导入完成后如图5所示。</strong></li></ul>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="397" height="309" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-89.png" alt="" class="wp-image-1190" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-89.png 397w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-89-300x234.png 300w" sizes="auto, (max-width: 397px) 100vw, 397px" /><figcaption>图5</figcaption></figure>
</div>


<p><strong>3</strong><strong>、用SQL语句完成以下查询</strong></p>



<p><strong>&nbsp;</strong><strong>（1）、从职工关系中检索所有月工资值；命令和运行结果如图6所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="854" height="673" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-90.png" alt="" class="wp-image-1191" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-90.png 854w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-90-300x236.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-90-768x605.png 768w" sizes="auto, (max-width: 854px) 100vw, 854px" /><figcaption>图6</figcaption></figure>
</div>


<p><strong>&nbsp;</strong><strong>（2）、检索仓库关系中的所有元组；命令和运行结果如图7所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="594" height="475" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-91.png" alt="" class="wp-image-1192" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-91.png 594w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-91-300x240.png 300w" sizes="auto, (max-width: 594px) 100vw, 594px" /><figcaption>图7</figcaption></figure>
</div>


<p><strong>&nbsp;</strong><strong>（3）、检索月工资多于2000元的职工对应的职工号、姓名；命令和运行结果如图8所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="233" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-92.png" alt="" class="wp-image-1193" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-92.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-92-300x81.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-92-768x207.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图8</figcaption></figure>
</div>


<p><strong>（4）、检索哪些仓库的面积为400~500㎡，列出仓库号和所在的城市；命令和运行结果如图9所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="137" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-93.png" alt="" class="wp-image-1194" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-93.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-93-300x48.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-93-768x122.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图9</figcaption></figure>
</div>


<p><strong>（5）、检索出广州有哪些仓库，列出仓库号；命令和运行结果如图10所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="239" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-94.png" alt="" class="wp-image-1195" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-94.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-94-300x83.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-94-768x212.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图10</figcaption></figure>
</div>


<p><strong>（6）、检索出所在城市为广州的仓库的个数；命令和运行结果如图11所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="162" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-95.png" alt="" class="wp-image-1196" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-95.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-95-300x56.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-95-768x144.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图11</figcaption></figure>
</div>


<p><strong>（7）、检索出所有职工的平均工资；命令和运行结果如图12所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="169" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-96.png" alt="" class="wp-image-1197" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-96.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-96-300x59.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-96-768x150.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图12</figcaption></figure>
</div>


<p><strong>（8）、检索出在WH5仓库工作的职工；命令和运行结果如图13所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="242" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-97.png" alt="" class="wp-image-1198" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-97.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-97-300x84.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-97-768x215.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图13</figcaption></figure>
</div>


<p><strong>（9）、检索出职工表中所有的仓库号，去掉重复值；命令和运行结果如图14所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="759" height="405" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-98.png" alt="" class="wp-image-1199" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-98.png 759w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-98-300x160.png 300w" sizes="auto, (max-width: 759px) 100vw, 759px" /><figcaption>图14</figcaption></figure>
</div>


<p><strong>（10）、检索出每个仓库的人数；命令和运行结果如图15所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="321" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-99.png" alt="" class="wp-image-1200" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-99.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-99-300x111.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-99-768x285.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图15</figcaption></figure>
</div>


<p><strong>（11）、检索出上海的仓库有哪些，列出仓库号、面积。查询结果按面积降序排列；命令和运行结果如图16所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="168" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-100.png" alt="" class="wp-image-1201" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-100.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-100-300x58.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-100-768x149.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图16</figcaption></figure>
</div>


<p><strong>（12）、检索出哪些仓库女职工的人数达到了3人；命令和运行结果如图17所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="102" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-101.png" alt="" class="wp-image-1202" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-101.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-101-300x35.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-101-768x91.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图17</figcaption></figure>
</div>


<p><strong>（13）、检索出所有姓胡的职工的职工号、姓名、性别、月工资。查询结果按性别排降序、月工资排升序；命令和运行结果如图18所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="198" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-102.png" alt="" class="wp-image-1203" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-102.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-102-300x69.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-102-768x176.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图18</figcaption></figure>
</div>


<p><strong>（14）、检索出职工“王玛丽”的年工资；命令和运行结果如图19所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="148" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-103.png" alt="" class="wp-image-1204" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-103.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-103-300x51.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-103-768x131.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图19</figcaption></figure>
</div>


<p><strong>（15）、检索出在WH1和WH2两个仓库工作的职工的基本信息；命令和运行结果如图20所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="189" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-104.png" alt="" class="wp-image-1205" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-104.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-104-300x66.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-104-768x168.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图20</figcaption></figure>
</div>


<p><strong>（16）、检索出年工资在24000元以上的职工的姓名、年工资值。命令和运行结果如图21所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="213" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-105.png" alt="" class="wp-image-1206" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-105.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-105-300x74.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-105-768x189.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图21</figcaption></figure>
</div>


<p><strong>五、实验结果与分析</strong><strong></strong></p>



<p><strong>&nbsp; </strong><strong>通过练习可以掌握SQL SERVER2008的查询方法。</strong></p>



<p><strong>六、结论与体会</strong><strong></strong></p>



<p>&nbsp; <strong>通过本实验，可以学会SQL语言SELECT语句的基本使用方法，熟练掌握单表查询、分组查询、聚集函数查询和查询结果排序，学会数据的导入与导出的方法。</strong></p>



<p>数据库资源下载：</p>



<div class="wp-block-file"><a id="wp-block-file--media-d4cfa7d1-ecba-456c-b59e-88a84a73c64a" href="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/数据库资源.7z">数据库资源</a><a href="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/数据库资源.7z" class="wp-block-file__button" download aria-describedby="wp-block-file--media-d4cfa7d1-ecba-456c-b59e-88a84a73c64a">下载</a></div>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.leexinghai.com/aic/h21026-%e5%ae%9e%e9%aa%8c4-%e6%95%b0%e6%8d%ae%e6%9f%a5%e8%af%a2%e7%9a%84%e6%93%8d%e4%bd%9c%ef%bc%88%e4%b8%80%ef%bc%89/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>H21019-实验3-表的创建与修改、完整性约束</title>
		<link>https://www.leexinghai.com/aic/h21019-%e5%ae%9e%e9%aa%8c3-%e8%a1%a8%e7%9a%84%e5%88%9b%e5%bb%ba%e4%b8%8e%e4%bf%ae%e6%94%b9%e3%80%81%e5%ae%8c%e6%95%b4%e6%80%a7%e7%ba%a6%e6%9d%9f/</link>
					<comments>https://www.leexinghai.com/aic/h21019-%e5%ae%9e%e9%aa%8c3-%e8%a1%a8%e7%9a%84%e5%88%9b%e5%bb%ba%e4%b8%8e%e4%bf%ae%e6%94%b9%e3%80%81%e5%ae%8c%e6%95%b4%e6%80%a7%e7%ba%a6%e6%9d%9f/#respond</comments>
		
		<dc:creator><![CDATA[李星海]]></dc:creator>
		<pubDate>Wed, 19 Oct 2022 08:46:37 +0000</pubDate>
				<category><![CDATA[数据库原理与应用]]></category>
		<guid isPermaLink="false">https://aic.leexinghai.com/?p=1077</guid>

					<description><![CDATA[一、实验目的 &#160;&#160;&#160; 通过本次实验，使读者学会通过结构化查询语言SQL的数据定义 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><strong>一、实验目的</strong><strong></strong></p>



<p><strong>&nbsp;&nbsp;&nbsp; </strong><strong>通过本次实验，使读者学会通过结构化查询语言SQL的数据定义语言CREATE、ALTER和DROP语句建立、修改和删除数据库基本表的方法，熟练掌握各种数据类型和掌握常用的数据完整性约束。</strong></p>



<p><strong>二、实验仪器设备、试剂或材料</strong><strong></strong></p>



<p><strong>&nbsp;&nbsp;&nbsp; </strong><strong>使用</strong><strong>SQL Server 2008</strong><strong>软件进行实验操作。</strong><strong></strong></p>



<p><strong>三、实验要求</strong></p>



<p><strong>在“学生选课”数据库中创建Student表、Course表和SC表。</strong></p>



<p><strong>（1）Student表，学号列为主键约束，性别列为检约束，性别只能取“男”或“女”。</strong></p>



<p><strong>（2）Course表，课程号为主键约束、课程号和课程名不能为空，先修课号参照课程号，并且规定每门课程的学分必须大于0。</strong></p>



<p><strong>（3）SC表，学生号参照Student表的学号，课程号参照Course表的课程号，学号和课程号为主键约束。</strong></p>



<p><strong>四、实验内容与步骤</strong></p>



<p><strong>&nbsp;&nbsp;</strong><strong>1</strong><strong>、创建“学生选课”数据库，在该数据库中创建Student表。命令和结果如图1所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="634" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-74.png" alt="" class="wp-image-1113" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-74.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-74-300x220.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-74-768x563.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption><strong>图1</strong></figcaption></figure>
</div>


<p><strong>2</strong><strong>、利用T-SQL命令创建Course表。命令和结果如图2所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="478" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-73.png" alt="" class="wp-image-1112" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-73.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-73-300x166.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-73-768x424.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图2</figcaption></figure>
</div>


<p><strong>3</strong><strong>、为已经创建的Student表创建一个约束。以默认约束为“计算机系”为例，构建SQL命令，代码和运行结果如图3所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="580" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-72.png" alt="" class="wp-image-1111" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-72.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-72-300x201.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-72-768x515.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption>图3</figcaption></figure>
</div>


<p><strong>4</strong><strong>、利用T-SQL命令创建SC表。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="865" height="374" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-71.png" alt="" class="wp-image-1110" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-71.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-71-300x130.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-71-768x332.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption><strong>图4</strong></figcaption></figure>
</div>


<p></p>



<p><strong>五、实验结果与分析</strong><strong></strong></p>



<p><strong>1.</strong><strong>所创建的表如图5所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="524" height="429" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-70.png" alt="" class="wp-image-1109" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-70.png 524w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-70-300x246.png 300w" sizes="auto, (max-width: 524px) 100vw, 524px" /><figcaption><strong>图</strong>5</figcaption></figure>
</div>


<p><strong>2.</strong><strong>创建的student观察其键值，如图6所示。</strong><strong></strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="866" height="606" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-69.png" alt="" class="wp-image-1108" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-69.png 866w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-69-300x210.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-69-768x537.png 768w" sizes="auto, (max-width: 866px) 100vw, 866px" /><figcaption>图6</figcaption></figure>
</div>


<p><strong>3.</strong><strong>创建的键值约束如图7所示。</strong></p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="490" height="530" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-68.png" alt="" class="wp-image-1107" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-68.png 490w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-68-277x300.png 277w" sizes="auto, (max-width: 490px) 100vw, 490px" /><figcaption><strong>图7</strong></figcaption></figure>
</div>


<p></p>



<p><strong>六、结论与体会</strong><strong></strong></p>



<p>&nbsp; 通过实验，学会通过结构化查询语言SQL的数据定义语言CREATE、ALTER和DROP语句建立、修改和删除数据库基本表的方法，熟练掌握各种数据类型和掌握常用的数据完整性约束。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.leexinghai.com/aic/h21019-%e5%ae%9e%e9%aa%8c3-%e8%a1%a8%e7%9a%84%e5%88%9b%e5%bb%ba%e4%b8%8e%e4%bf%ae%e6%94%b9%e3%80%81%e5%ae%8c%e6%95%b4%e6%80%a7%e7%ba%a6%e6%9d%9f/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>H21012-教材实验1、2</title>
		<link>https://www.leexinghai.com/aic/h21012-%e6%95%99%e6%9d%90%e5%ae%9e%e9%aa%8c1%e3%80%812/</link>
					<comments>https://www.leexinghai.com/aic/h21012-%e6%95%99%e6%9d%90%e5%ae%9e%e9%aa%8c1%e3%80%812/#respond</comments>
		
		<dc:creator><![CDATA[李星海]]></dc:creator>
		<pubDate>Wed, 12 Oct 2022 13:52:47 +0000</pubDate>
				<category><![CDATA[数据库原理与应用]]></category>
		<guid isPermaLink="false">https://aic.leexinghai.com/?p=976</guid>

					<description><![CDATA[SQL Server 2008 的基本知识与操作 一、实验目的 &#160;&#160;&#160; 通过本实 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">SQL Server 2008 的基本知识与操作</h2>



<p><strong>一、实验目的</strong></p>



<p><strong>&nbsp;&nbsp;&nbsp; </strong><strong>通过本实验，使学生了解SQL Server 2008 服务器的注册、启动、暂停、查看与设置服务器的属性等操作，掌握SQL Server 2008所提供的系统数据库，学习利用SQL Server Management Studio的功能创建和修改数据库，掌握数据库中主数据文件、辅助数据文件、日志文件三类文件的作用；利用SQL Server Management Studio删除、分离、附加数据库。</strong></p>



<p><strong>二、实验仪器设备或材料</strong><strong></strong></p>



<p><strong>&nbsp;&nbsp;&nbsp; </strong><strong>使用</strong><strong>SQL Server 2008</strong><strong>软件进行实验操作。</strong><strong></strong></p>



<p><strong>三、实验要求</strong><strong></strong></p>



<p><strong>利用</strong><strong>SQL Server Management Studio</strong><strong>的对象资源管理创建“学生选课”数据库，设置主数据文件、辅助数据文件和日志文件三类文件，熟悉系统数据库的master数据库、model数据库、msdb数据库和tempdb数据库的作用。</strong></p>



<p><strong>对“学生选课”数据库进行修改、分离和附加操作，最后删除该数据库。</strong><strong></strong></p>



<p><strong>四、实验内容与步骤</strong></p>



<ol class="wp-block-list" type="1"><li><strong>打开数据库管理软件，连接数据库服务器，如图1所示。</strong></li></ol>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="866" height="455" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-15.png" alt="" class="wp-image-977" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-15.png 866w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-15-300x158.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-15-768x404.png 768w" sizes="auto, (max-width: 866px) 100vw, 866px" /><figcaption><strong>图1</strong></figcaption></figure>



<p><strong>2</strong><strong>、</strong><strong>创建数据库，设置数据库名称为“学生选课”,如图2所示。</strong><strong></strong></p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="865" height="525" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-16.png" alt="" class="wp-image-978" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-16.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-16-300x182.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-16-768x466.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption><strong>图2</strong></figcaption></figure>



<ul class="wp-block-list"><li><strong>修改数据库：在左侧对应数据库的“属性”的“文件”选单中可以修改数据库的属性和参数，如图3所示。</strong></li></ul>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="865" height="525" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-17.png" alt="" class="wp-image-979" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-17.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-17-300x182.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-17-768x466.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption><strong>图3</strong></figcaption></figure>



<ul class="wp-block-list"><li><strong>删除数据库：右键点击相应数据库，在弹出选项列表中点击“删除”按钮，出现删除数据库界面，可以删除数据库，如图4所示。</strong></li></ul>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="865" height="525" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-18.png" alt="" class="wp-image-980" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-18.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-18-300x182.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-18-768x466.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption><strong>图4</strong></figcaption></figure>



<ul class="wp-block-list"><li><strong>附加和分离数据库：我们再次创建一个“抽象”数据库，先将其分离（仅本地服务器），然后右键点击“附加”按钮，在弹出的页面中点击“添加”，选择“抽象”数据库，完成附加，如图5所示，附加完成如图6所示。</strong></li></ul>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="797" height="467" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-20.png" alt="" class="wp-image-982" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-20.png 797w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-20-300x176.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-20-768x450.png 768w" sizes="auto, (max-width: 797px) 100vw, 797px" /><figcaption>图5</figcaption></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="865" height="525" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-19.png" alt="" class="wp-image-981" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-19.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-19-300x182.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-19-768x466.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption><strong>图6</strong></figcaption></figure>



<ul class="wp-block-list"><li><strong>分离数据库：右键数据库，在“任务”菜单可以点按“分离”数据库，如图7所示，弹出如图8所示界面，可以完成数据库的分离。</strong></li></ul>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="865" height="749" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-21.png" alt="" class="wp-image-983" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-21.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-21-300x260.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-21-768x665.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption><strong>图7</strong></figcaption></figure>



<p></p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="865" height="525" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-22.png" alt="" class="wp-image-984" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-22.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-22-300x182.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-22-768x466.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption><strong>图8</strong></figcaption></figure>



<p><strong>五、实验结果与分析</strong><strong></strong></p>



<p><strong>&nbsp; </strong><strong>通过本实验，可以了解SQL Server 2008 服务器的注册、启动、暂停、查看与设置服务器的属性等操作，掌握SQL Server 2008所提供的系统数据库</strong><strong></strong></p>



<p><strong>六、结论与体会</strong><strong></strong></p>



<p>&nbsp; <strong>SQL Server</strong><strong>数据库属于微软开发的数据库，通过对该数据库的学习，可以掌握微软数据库的创建和配置等基础操作，为后续学习提供必要的前置条件。</strong><strong></strong></p>



<h2 class="wp-block-heading"> 实验2-管理数据库操作 &nbsp;&nbsp;&nbsp;&nbsp;</h2>



<p><strong>一、实验目的</strong><strong></strong></p>



<p><strong>&nbsp;&nbsp;&nbsp; </strong><strong>通过本实验，使读者了解</strong><strong>SQL Server 2008</strong><strong>的“新建查询”方法，学会通过结构化查询语言SQL的数据定义语言CREATE、ALTER和DROP语句建立、修改和删除数据库的方法，掌握数据库属性的设置。</strong><strong></strong></p>



<p><strong>二、实验仪器设备、试剂或材料</strong></p>



<p><strong>&nbsp;&nbsp;&nbsp; </strong><strong>使用</strong><strong>SQL Server 2008</strong><strong>软件进行实验操作。</strong><strong></strong></p>



<p><strong>三、实验要求</strong><strong></strong></p>



<p><strong>（1）</strong><strong>利用</strong><strong>SQL Server Management Studio</strong><strong>创建一个名为SM的数据库，初始大小为3MB，最大为50MB，数据库自动增长，增长方式按10%；日志文件初始大小为2MB，最大值不受限制，按1MB增长。</strong></p>



<p><strong>（2）通过SQL语句创建一个名为“学籍”的数据库，指定主文件名为“学籍_data”，假设存储路径为“d:\example\学籍_data.mdf”，该数据文件的初始大小为10MB，最大为100MB，增长方式按10MB增长；指定主日志文件名为“学霸_log”，存储路径为：“d:\example\学籍_log.ldf”，该日志文件初始大为20MB,最大为200MB，按10MB增长。</strong></p>



<p><strong>（3）使用SQL语句ALTER在“学籍”数据库中添加一个数据文件“学籍_datal”，指定其起初大小为4MB，最大值不受限制，增长方式按10%增长。</strong></p>



<p><strong>（4）使用SQL语句 DROP删除数据库。</strong></p>



<p><strong>四、实验内容与步骤</strong></p>



<p><strong>1、创建数据库的操作：在“新建查询”输入下文本框的命令，可以创建一个“奥义”数据库。</strong></p>



<pre class="wp-block-code"><code><img loading="lazy" decoding="async" width="495" height="285" src="" alt="文本框: CREATE DATABASE 奥义
ON PRIMARY
(Name= 奥义_data,
Filename='c:\takeitboy\奥义_data.mdf',
Size=10,
Maxsize=100,
Filegrowth=10)
LOG ON
(Name=奥义_log,
Filename='c:\takeitboy\奥义_log.ldg',
Size=10,
Maxsize=200,
Filegrowth=10)
">

</code></pre>



<p><strong>完成命令输入后，右键“执行”可以完成数据库的创建，如图2所示。</strong></p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="865" height="726" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-23.png" alt="" class="wp-image-985" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-23.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-23-300x252.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-23-768x645.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /></figure>



<p><strong>图2</strong></p>



<p><strong>修改数据库的操作：在“新建查询”输入下文本框的命令，可以修改“奥义”数据库的大小，最大容量和增长幅度。</strong></p>



<pre class="wp-block-code"><code><img loading="lazy" decoding="async" width="509" height="180" src="" alt="文本框: ALTER DATABASE 奥义
ADD FILE
(name='奥义_data1',
filename='c:\takeitboy\奥义_data1.mdf',
size=4,
maxsize=unlimited,
filegrowth=10%)
GO
"></code></pre>



<p><strong>完成命令输入后，右键“执行”可以完成数据库的创建，如图3所示。</strong></p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="729" height="958" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-24.png" alt="" class="wp-image-986" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-24.png 729w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-24-228x300.png 228w" sizes="auto, (max-width: 729px) 100vw, 729px" /><figcaption><strong>图3</strong></figcaption></figure>



<p><strong>3</strong><strong>、删除数据库的操作：如图4所示，可以使用图形化界面删除数据库，也可以使用如图5所示的命令完成数据库的删除操作。</strong></p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="865" height="681" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-25.png" alt="" class="wp-image-987" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-25.png 865w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-25-300x236.png 300w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-25-768x605.png 768w" sizes="auto, (max-width: 865px) 100vw, 865px" /><figcaption><strong>图4</strong></figcaption></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="474" height="594" src="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-26.png" alt="" class="wp-image-988" srcset="https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-26.png 474w, https://www.leexinghai.com/aic/wp-content/uploads/2022/10/image-26-239x300.png 239w" sizes="auto, (max-width: 474px) 100vw, 474px" /><figcaption><strong>图5</strong></figcaption></figure>



<p><strong>五、实验结果与分析</strong><strong></strong></p>



<p><strong>&nbsp; </strong><strong>通过</strong><strong>使用</strong><strong>CREATE</strong><strong>、ALTER和DROP语句，可以对数据库进行建立、修改和删除操作，从而在仅使用命令窗口的情况下也可以对数据库进行操作，从而使对数据库的操作和练习更加熟练。</strong><strong></strong></p>



<p><strong>六、结论与体会</strong><strong></strong></p>



<p>&nbsp; <strong>通过实验练习，可以了解SQL Server 2008的“新建查询”方法，通过结构化查询语言SQL的数据定义语言CREATE、ALTER和DROP语句建立、修改和删除数据库的方法，掌握数据库属性的设置。</strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.leexinghai.com/aic/h21012-%e6%95%99%e6%9d%90%e5%ae%9e%e9%aa%8c1%e3%80%812/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
