TAW_11 Chapter 4, ABAP open SQL Flashcards

1
Q

What are the two components of the SAP database interface (DBSS)

A

ABAP Open SQL interface and native SQL interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the tasks of the ABAP OPEN SQL interface?

A

Convert OPEN SSQL to native sql
Client handling
Managing the table buffer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What tcode is used for sql tracing

A

ST05

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

There are two types of database optimizers. What are they?

A

Rule based and Cost based

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the recommended maximum size of a buffered table?

A

Less than 10mb

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Will secondary indexes use the table buffers?

A

Nope

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What table stores info for possible buffered table changes?

A

DDLOG

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What transaction contains the buffer trace?

A

ST05

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

When can ORDER BY not be used?

A

Cluster and Pooled tables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the prereqs for ORDER BY PRIMARY KEY?

A

All primary key fields including MANDT must be in the field list. Only a single transparent table can be in the FROM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

When using DISTINCT on pooled and cluster tables what syntax must be used?

A

SELECT DISTINCT *

You cannot select individual columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the 5 aggregate expressions for open SQL

A
MAX( col )
MIN( col )
COUNT( * ) RETURNED AS TYPE I
AVG( col )  RETURNED AS TYPE F
SUM
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which aggregate expressions can be combined with DISTINCT?

A

All of them, but min, max, avg , and sum make little sense primarily it is used with count

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Can a GROUP BY be used with SELECT *?

A

No, a field list must exist

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Can group by be used with POOL or CLUSTER tables

A

no

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What field types can not be used in GROUP BY

A

STRING and RAWSTRING

17
Q

What fields must be listed in the group by?

A

All fields that are not part of the aggregate functions

18
Q

Can group by contain table fields that are not part of the field list?

A

Yes, but it is a bad idea because it makes the results difficult to read

19
Q

Can HAVING be used without GROUP BY?

A

No

20
Q

What fields can be contained in the HAVING

A

Fields that are part of the GROUP BY and aggregate functions. In this case the aggregate functions will operate against the GROUPS created by the group by

21
Q

The only reason to use

SELECT …. ENDSELECT is

A

Extremely large amounts of data that would overwhelm the app server memory

22
Q

With in a SELECT … END?SELECT can I select into an internal table

A

Yes, if you use the package size addition

23
Q

Does SAP Open SQL support UNION and UNION ALL

A

Yes

24
Q

If in a select statement I want to combine field with a literal, what would that look like

A

SELECT bob && ‘name’ AS bobname

25
Q

What are the new operators and functions in open sql for string expressions

A
&&
LENGTH
LPAD
LTRIM
RTRIM
RIGHT
REPLACE
SUBSTRING
CONCAT
26
Q

Is there a difference between && and CONCAT?

A

&& can have multiple occurrences such as
fld1 && fld2 && fld3
CONCAT has exactly 2 occurrences
The result of all && can be 255 chars, CONCAT can be 1333 chars
&& is only used between elementary objects. CONCAT can handle string objects and string functions
&& keeps spaces in constants and lieterals, CONCAT has no special space handling

27
Q

What are the new operators and functions in open SQL for arithmetic expressions

A

+,-,*,/

ABS, CEIL, FLOOR DIV, MOD, ROUND

28
Q

If the field in the select does not have the required target type, how can i be converted?

A

With the CAST as type

CAST( fld1 as FLTP )

29
Q

When using operator / in a select, what type do the operands need to be?

A

Type F
So CAST( num1 AS FLTP ) /
CAST( num2 AS FLTP) *
CAST( 100 AS FLTP ) AS fld2

30
Q

Give an example of case in a select

A
Simple
CASE fld1
  WHEN opr1 then result1
  WHEN opr2 then result2
  ELSE result3
END  AS fld2
Complex
CASE WHEN sql_cond1 then result1
           WHEN sql_cond2 then result2
           ELSE result3
END AS fld2
31
Q

In a JOIN can fields from the right table exist in the where clause?

A

Yes they can now!

32
Q

Is a field from the right table required for the ON of a join?

A

Not anymore

33
Q

Must the mandt be supplied in a join

A

not anymore

34
Q

How many tables can be in a join

A

50

35
Q

How many tables can be in a join

A

50

36
Q

The ON operator can only be =, is this true

A

Not anymore Between, less than, greater than

37
Q

How is a subquery initiated?

A

WHERE EXISTS ( Select….) or
WHERE fld1 = ( SELECT MAX( myfld ) from …)
WHERE fld1 IN ( SELECT DISTINCT fld1 )