Creating Queries Flashcards

1
Q

What does the ‘GROUP BY’ function do?

A

*If your attribute has more than one category you can use the group by function to help see it in a stacked (eg. stacked bar chart) format

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

What 4 SiGNAL operators are available?

A
  1. arithmetic
  2. comparison
  3. logical
  4. mapping
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain Arithmetic

A

+ - * / %(modulo i.e remainder)

eg. SELECT discount / price * 100
FROM THIS_PROCESS

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

Explain Comparison

A

> < >= <= = <>(not equal to)

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

Explain Logical

A

AND , IN, NOT, OR

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

Explain Mapping

A

IF (returning value based on condition)

eg. SELECT IF (condition, then, else)

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

Explain ‘Order by’ function

A

Function to sort the result set according to sorting criteria

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

Example of the order by function

A

‘ORDER BY column number ASC/DESC

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

Explain ‘Limit’ function

A

Function to limit the number of records in the result set

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

Example of the ‘Limit’ function

A

LIMIT no. of entries you want

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

What is Alias with and example

A

Aliases help to give data/column headers a temporary name to make them easier to read.

SELECT expression AS [“ALIAS”]
e.g SELECT “Case ID” as “Customer ID” (on the table produced it will be labelled as customer ID)

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

What is a subquery

A

a query that is nested inside a SELECT statement, or inside another sub query

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

when is subqueries used?

A

when retrieving data on an event-level

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

What are 3 date functions

A

DATE_TRUNC
NOW()
DURATION

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

Explain DATE_TRUNC

A

limits time stamps to certain units of time by removing detail

eg. SELECT….
DATE_TRUNC (‘Month’, (SELECT(end_time))).
as ‘Month in 2017’

[created row called ‘Month in 2017’, where it produced dates that stayed as the first day on every month in 2017, with the month only changing]

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

Explain NOW()

A

Helps calculate the duration between the current and given time

e.g SELECT…
(SELECT NOW() - LAST(end_time)) as “Last order”

[created row called ‘last order’, produced durations eg. 3y 4w]

16
Q

Explain DURATION

A

Compares a duration of time with a threshold, and support strings (e.g “2 weeks”, “3days”)

eg. …
WHERE (SELECT LAST(end_time) - FIRST (End_time)) > DURATION “2weeks”

17
Q

What is the FILTER function for?

A

allows you to filter an input for an aggregations function

18
Q

Structure of the filter function

A

SELECT expressions
FILTER (WHERE conditions)
FROM table/process

19
Q

What are matching operators?

A

Matches allow you to filter cases based on the indicated ‘MATCHES’ terms

20
Q

[explain these matching operators]
A->B
A~>B
^A

A

[when it says directly followed you have to remember this is mapping a diagram so its the next task]

A->B : A direction followed by B
A~>B : A indirectly or directly followed by B
^A : sequence starts with A in any specific case

21
Q

[explain these matching operators]
A NULL
NOT A
A NOT B
A NOT (B|C)
(A|B)

A

A NULL : A value is NULL
NOT A : All values that are not A
A NOT B : A directly followed by a value that is not B
A NOT (B|C) : A followed by a value that is not B or C
(A|B) : A or B

22
Q

[explain these matching operators]
B$
A ANY

A

B$ : Sequence ends with B in any specific case
A ANY : A occurs anywhere in the case

23
Q

What is BEHAVIOUR MATCHES operator with an example

A

Allows to filter MATCHES even further with expressions not related to task sequence

eg. (trying to obtain values where the end time is greater than a specific date for shipping goods)
WHERE BEHAVIOUR
(event_name = “Ship Goods Standard” and END_TIME > Date ‘2017-08-17’ ) AS behaviour_one
(event_name = “Receive Customer order” and END_TIME > Date ‘2017-08-17’ ) AS behaviour_two

MATCHES (^behaviour_one~>behaviour_two)