首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

【SAP ABAP系列】ABAP数据库操作

1、abap语言使用的数据库语言:open sql ,Native sql(特定数据库自身sql) 2、使用OPen SQL注意的原则:     a、尽可能减少满足条件的数据条目数量。     b、减少数据的传输量,以减少网络流量。     c、减少访问的数据库表量。     d、减少查询难度,可以通过整理选择标准来实现。     e、减少数据库负载。 3、使用Native sql有两个前提:     a、知道使用数据库的类型。     b、了解该数据库的SQL语法。 4、ABAP的数据定义由数据字典创建。 5、提取数据方式:内表,工作区,变量。 6、select语句: select <result> from <source> into <target>        where <condition> [group by <field>]        [having <cond>][order by <field>]. 7、选择单行全部数据: select single * from spfli into wa_spfli where cityform='singapore' and into cityto='beijing'. 8、选择单行指定字段: select single carrid connid from spfli into (wa_carrid,wa_connid) where cityform='singapore' and into cityto='beijing'. 9、选择相关字段: select single carrid connid *from spfli into corresponding fields of wa_spfli where cityform='singapore' and into cityto='beijing'. 10、循环选择: select * from spfli into wa_spfli. write:/ wa_spfli-carrid,wa_spfli-connid. endselect. 11、选择至内表: select * from spfli into table  ta_spfli. 读取时: loop at ta_spfli. write:/ta_spfli-carrid ta_spfli-connid. end loop. 12、指定查询条件 比较运算符:= <  > <>  <=  >=   范围限定运算符: [not] between 字符比较运算符:[not] like   '_'替代单个字符,'%'任意字符 忽略符号: select....where func like 'EDIT#_%' escape '#'. escape是指忽略'#'。 检查值列表: select .....where city in ('Berlin','Rome','London').指定城市'Berlin','Rome','London'。 检查空值:where ...f  is [not] null..... 检查选择表:where ...f [not] in seltab....   seltab是选择标准表,是具有特定格式的内表,可以 通过select-options语句添加到程序和报表选择屏幕,并由报表用户填充,在可以在程序中创建(如使用 range语句) 13、动态指定查询条件: report Z_test. data:cond(72) type c, itab like table of cond, city1(10) value 'BEIJING', city1(10) value 'SINGAPORE', itab_spfli like talbe of spfli with header line... concatenate 'cityfrom = '''city1'''' into cond. append cond to itab. concatenate 'cityfto' ='''city2'''' into cond. append cond to itab. select * into table itab_spfli from spfli where (itab). 14、多表结合查询(嵌套,效率较低): reprot z_test. data: wa_carrid type spfli-carrid, wa_connid type spfli-connid, wa_carrname type scarr-carrname. select carrid connid from spfli into (wa_carrid,wa_connid) where cityform='singapore' and into cit

00

ABAP数据库操作

1、abap语言使用的数据库语言:open sql ,Native sql(特定数据库自身sql) 2、使用OPen SQL注意的原则: a、尽可能减少满足条件的数据条目数量。 b、减少数据的传输量,以减少网络流量。 c、减少访问的数据库表量。 d、减少查询难度,可以通过整理选择标准来实现。 e、减少数据库负载。 3、使用Native sql有两个前提: a、知道使用数据库的类型。 b、了解该数据库的SQL语法。 4、ABAP的数据定义由数据字典创建。 5、提取数据方式:内表,工作区,变量。 6、select语句: select <result> from <source> into <target> where <condition> [group by <field>] [having <cond>][order by <field>]. 7、选择单行全部数据: select single * from spfli into wa_spfli where cityform='singapore' and into cityto='beijing'. 8、选择单行指定字段: select single carrid connid from spfli into (wa_carrid,wa_connid) where cityform='singapore' and into cityto='beijing'. 9、选择相关字段: select single carrid connid *from spfli into corresponding fields of wa_spfli where cityform='singapore' and into cityto='beijing'. 10、循环选择: select * from spfli into wa_spfli. write:/ wa_spfli-carrid,wa_spfli-connid. endselect. 11、选择至内表: select * from spfli into table ta_spfli. 读取时: loop at ta_spfli. write:/ta_spfli-carrid ta_spfli-connid. end loop. 12、指定查询条件 比较运算符:= < > <> <= >= 范围限定运算符: [not] between 字符比较运算符:[not] like '_'替代单个字符,'%'任意字符 忽略符号: select....where func like 'EDIT#_%' escape '#'. escape是指忽略'#'。 检查值列表: select .....where city in ('Berlin','Rome','London').指定城市'Berlin','Rome','London'。 检查空值:where ...f is [not] null..... 检查选择表:where ...f [not] in seltab.... seltab是选择标准表,是具有特定格式的内表,可以 通过select-options语句添加到程序和报表选择屏幕,并由报表用户填充,在可以在程序中创建(如使用 range语句) 13、动态指定查询条件: report Z_test. data:cond(72) type c, itab like table of cond, city1(10) value 'BEIJING', city1(10) value 'SINGAPORE', itab_spfli like talbe of spfli with header line... concatenate 'cityfrom = '''city1'''' into cond. append cond to itab. concatenate 'cityfto' ='''city2'''' into cond. append cond to itab. select * into table itab_spfli from spfli where (itab). 14、多表结合查询(嵌套,效率较低): reprot z_test. data: wa_carrid type spfli-carrid, wa_connid type spfli-connid, wa_carrname type scarr-carrname. select carrid connid from spfl

01

MySQL常用命令

启动:net start mySql; 进入:mysql -u root -p/mysql -h localhost -u root -p databaseName; 列出数据库:show databases; 选择数据库:use databaseName; 列出表格:show tables; 显示表格列的属性:show columns from tableName; 建立数据库:source fileName.txt; 匹配字符:可以用通配符_代表任何一个字符,%代表任何字符串; 增加一个字段:alter table tabelName add column fieldName dateType; 增加多个字段:alter table tabelName add column fieldName1 dateType,add columns fieldName2 dateType; 多行命令输入:注意不能将单词断开;当插入或更改数据时,不能将字段的字符串展开到多行里,否则硬回车将被储存到数据中; 增加一个管理员帐户:grant all on *.* to user@localhost identified by "password"; 每条语句输入完毕后要在末尾填加分号';',或者填加'\g'也可以; 查询时间:select now(); 查询当前用户:select user(); 查询数据库版本:select version(); 查询当前使用的数据库:select database(); 1、删除student_course数据库中的students数据表: rm -f student_course/students.* 2、备份数据库:(将数据库test备份) mysqldump -u root -p test>c:\test.txt 备份表格:(备份test数据库下的mytable表格) mysqldump -u root -p test mytable>c:\test.txt 将备份数据导入到数据库:(导回test数据库) mysql -u root -p test 3、创建临时表:(建立临时表test_temp) create temporary table test_temp(name varchar(10)); 4、创建表是先判断表是否存在 create table if not exists students(……); 5、从已经有的表中复制表的结构 create table table2 select * from table1 where 1<>1; 6、复制表 create table table2 select * from table1; 7、对表重新命名 alter table table1 rename as table2; 8、修改列的类型 alter table table1 modify id int unsigned;//修改列id的类型为int unsigned alter table table1 change id sid int unsigned;//修改列id的名字为sid,而且把属性修改为int unsigned 9、创建索引 alter table table1 add index ind_id (id); create index ind_id on table1 (id); create unique index ind_id on table1 (id);//建立唯一性索引 10、删除索引 drop index idx_id on table1; alter table table1 drop index ind_id; 11、联合字符或者多个列(将列id与":"和列name和"="连接) select concat(id,':',name,'=') from students; 12、limit(选出10到20条)<第一个记录集的编号是0> select * from students order by id limit 9,10; 13、MySQL不支持的功能 事务,视图,外键和引用完整性,存储过程和触发器 14、MySQL会使用索引的操作符号 <,<=,>=,>,=,between,in,不带%或者_开头的like 15、使用索引的缺点 1)减慢增删改数据的速度; 2)占用磁盘空间; 3)增加查询优化器的负担; 当查询优化器生成执行计划时,会考虑索引,太多的索引会给查询优化器增加

01

这是我见过最有用的Mysql面试题,面试了无数公司总结的(内附答案)

1.什么是数据库? 数据库是组织形式的信息的集合,用于替换,更好地访问,存储和操纵。 也可以将其定义为表,架构,视图和其他数据库对象的集合。 2.什么是数据仓库? 数据仓库是指来自多个信息源的中央数据存储库。 这些数据经过整合,转换,可用于采矿和在线处理。 3.什么是数据库中的表? 表是一种数据库对象,用于以保留数据的列和行的形式将记录存储在并行中。 4.什么是数据库中的细分? 数据库表中的分区是分配用于在表中存储特定记录的空间。 5.什么是数据库中的记录? 记录(也称为数据行)是表中相关数据的有序集

02
领券