SQL语言入门教程:第五课 删除数据库表格

<script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

第五课 删除数据库表格

在SQL语言中使用drop table命令删除某个表格以及该表格中的所有记录。drop table命令的使用格式为:

drop table tablename;

例如:

drop table employee;

如果用户希望将某个数据库表格完全删除,只需要在drop table命令后输入希望删除的表格名称即可。drop table命令的作用与删除表格中的所有记录不同。删除表格中的全部记录之后,该表格仍然存在,而且表格中列的信息不会改变。而使用drop table命令则会将整个数据库表格的所有信息全部删除。

以上,我们对SQL语言主要的命令和语句进行了较为详细的介绍。应该说SQL语句的语法结构和风格还是相当简单和直观的,只要用户结合实践多加练习,一定会在短期内迅速掌握。

以Store_Information数据表为例,我们可以在GROUP BY一节中所使用的SQL命令中设置如下字段和数据表别名:

SELECT A1.store_name Store, SUM(Sales) "Total Sales"

FROM Store_Information A1

GROUP BY A1.store_name

查询结果显示为:

Store Total Sales

Los Angeles $1800

San Diego $250

Boston $700 <script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值