做报表需要知道的基本的SQL语句
1、查询数据:编摒蛲照燔号表示查询顺序。(8) select (9) distinct (11) <top_specification > <select_list>稆糨孝汶;(1)from<lef t_table>(3) <join_type> join <right_table>(2) on <join _condition>(4) where <where_condition>(5)group by <group_by_list>(6) with {cube|rollup}(7)having(having_condition)(10) order by <order_by_condition>

3、把筛选后的数据插入到一张还不存在的临时表中:select * into 目标表 from 表 where ...

5、把A数据库的某个表的数据全部插入到B数据库的某个表中:select * into B.btable from A.atable where ...

7、为某表增加字段:alter table表名ADD 字段名 类型

9、为某表修改数据内容:update tablename set name =’张三‘ where name =’李四‘。该命令需要执行“commit”之后才会生效。

11、删除某表某条数据:delete from table where condition

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:75
阅读量:46
阅读量:71
阅读量:92
阅读量:92