Oracle XE query result wraps and looks clumsy in SQL command line - oracle-xe

Im using oracle XE on windows7. In SQL command line, the query results were wrapped, each row has table header wraped for each row and the console looks horrible to read through results.
Let me know the command to indent(set right) the results columns on single line and each row one by one.
"
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
CLUSTER_NAME IOT_NAME STATUS
------------------------------ ------------------------------ --------
PCT_FREE PCT_USED INI_TRANS MAX_TRANS INITIAL_EXTENT NEXT_EXTENT
---------- ---------- ---------- ---------- -------------- -----------
MIN_EXTENTS MAX_EXTENTS PCT_INCREASE FREELISTS FREELIST_GROUPS LOG B NUM_ROWS
----------- ----------- ------------ ---------- --------------- --- - ----------
BLOCKS EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN
---------- ------------ ---------- ---------- -----------
AVG_SPACE_FREELIST_BLOCKS NUM_FREELIST_BLOCKS
------------------------- -------------------
DEGREE
----------------------------------------
INSTANCES CACHE TABLE_LO
---------------------------------------- -------------------- --------
SAMPLE_SIZE LAST_ANAL PAR IOT_TYPE T S NES BUFFER_ FLASH_C CELL_FL ROW_MOVE
----------- --------- --- ------------ - - --- ------- ------- ------- --------
GLO USE DURATION SKIP_COR MON CLUSTER_OWNER DEPENDEN
--- --- --------------- -------- --- ------------------------------ --------
COMPRESS COMPRESS_FOR DRO REA SEG RESULT_...."

Related

Stream Table join ksql giving no output

So the issue is after joining Stream with Table I am getting no results.
I have already checked partition count on both sides, that is 1.
Key type for both entities is varchar, and name of keys in both sides are also same.
below is the data I have.
Step 0. SET 'auto.offset.reset' = 'earliest';
Step 1. Stream I have:
ksql> describe L_EMPLOYEE1_KEYED_STREAM extended;
Name : L_EMPLOYEE1_KEYED_STREAM
Type : STREAM
Timestamp field : Not set - using <ROWTIME>
Key format : KAFKA
Value format : JSON
Kafka topic : L_EMPLOYEE1_KEYED_STREAM (partitions: 1, replication: 1)
Statement : CREATE STREAM L_EMPLOYEE1_KEYED_STREAM WITH (KAFKA_TOPIC='L_EMPLOYEE1_KEYED_STREAM', PARTITIONS=1, REPLICAS=1) AS SELECT * FROM L_EMPLOYEE1 L_EMPLOYEE1 PARTITION BY L_EMPLOYEE1.L_EID EMIT CHANGES;
Field | Type
-----------------------------------
L_EID | VARCHAR(STRING) (key)
NAME | VARCHAR(STRING)
LNAME | VARCHAR(STRING)
L_ADD_ID | VARCHAR(STRING)
-----------------------------------
Queries that write from this STREAM
----------------------------------- CSAS_L_EMPLOYEE1_KEYED_STREAM_37 (RUNNING) : CREATE STREAM L_EMPLOYEE1_KEYED_STREAM WITH (KAFKA_TOPIC='L_EMPLOYEE1_KEYED_STREAM', PARTITIONS=1, REPLICAS=1) AS SELECT * FROM L_EMPLOYEE1 L_EMPLOYEE1 PARTITION BY L_EMPLOYEE1.L_EID EMIT CHANGES;
For query topology and execution plan please run: EXPLAIN <QueryId>
Runtime statistics by host
------------------------- Host | Metric | Value | Last Message
----------------------------------------------------------------------------- ksql-server:8088 | messages-per-sec | 0 | 2023-02-14T08:20:44.489Z ksql-server:8088 | total-messages | 2 | 2023-02-14T08:20:44.489Z
----------------------------------------------------------------------------- (Statistics of the local KSQL server interaction with the Kafka topic L_EMPLOYEE1_KEYED_STREAM)
Consumer Groups summary:
Consumer Group :
_confluent-ksql-default_query_CSAS_L_EMPLOYEE1_KEYED_STREAM_37
Kafka topic : L_EMPLOYEE1 Max lag : 0
Partition | Start Offset | End Offset | Offset | Lag
------------------------------------------------------ 0 | 0 | 2 | 2 | 0
------------------------------------------------------
Step 2. Table I have
ksql> describe ID_MAP_KEYED_TABLE extended;
Name : ID_MAP_KEYED_TABLE
Type : TABLE
Timestamp field : Not set - using <ROWTIME>
Key format : KAFKA
Value format : JSON
Kafka topic : ID_MAP_KEYED_STREAM (partitions: 1, replication: 1)
Statement : CREATE TABLE ID_MAP_KEYED_TABLE (L_EID STRING PRIMARY KEY, R_EID STRING, L_ADD_ID STRING, R_ADD_ID STRING) WITH (KAFKA_TOPIC='ID_MAP_KEYED_STREAM', KEY_FORMAT='KAFKA', VALUE_FORMAT='JSON');
Field | Type
-------------------------------------------
L_EID | VARCHAR(STRING) (primary key)
R_EID | VARCHAR(STRING)
L_ADD_ID | VARCHAR(STRING)
R_ADD_ID | VARCHAR(STRING)
-------------------------------------------
Runtime statistics by host
-------------------------
Host | Metric | Value | Last Message
-----------------------------------------------------------------------------
ksql-server:8088 | messages-per-sec | 0 | 2023-02-14T08:13:11.214Z
ksql-server:8088 | total-messages | 2 | 2023-02-14T08:13:11.214Z
-----------------------------------------------------------------------------
(Statistics of the local KSQL server interaction with the Kafka topic ID_MAP_KEYED_STREAM)
Step 3. data in both entities:
ksql> select * from L_EMPLOYEE1_KEYED_STREAM;
+--------------------------------------------------+--------------------------------------------------+--------------------------------------------------+--------------------------------------------------+
|L_EID |NAME |LNAME |L_ADD_ID |
+--------------------------------------------------+--------------------------------------------------+--------------------------------------------------+--------------------------------------------------+
|101 |Dhruv |S |201 |
|102 |Dhruv1 |S1 |202 |
Query Completed
Query terminated
ksql> select * from ID_MAP_KEYED_TABLE emit changes;
+--------------------------------------------------+--------------------------------------------------+--------------------------------------------------+--------------------------------------------------+
|L_EID |R_EID |L_ADD_ID |R_ADD_ID |
+--------------------------------------------------+--------------------------------------------------+--------------------------------------------------+--------------------------------------------------+
|101 |1001 |201 |2001 |
|102 |1002 |202 |2002 |
^CQuery terminated
Step 4. Join operation and its result:
ksql> select map.R_eid, L_emp.name, L_emp.lname, map.R_add_id from L_EMPLOYEE1_KEYED_STREAM L_emp inner join ID_MAP_KEYED_TABLE map on map.L_eid=L_emp.L_eid emit changes;
+--------------------------------------------------+--------------------------------------------------+--------------------------------------------------+--------------------------------------------------+
|R_EID |NAME |LNAME |R_ADD_ID |
+--------------------------------------------------+--------------------------------------------------+--------------------------------------------------+--------------------------------------------------+
Absolutely blank. not sure why is this happening.
I tried getting results with where clause they're working fine individually and giving results.
please help me complete my POC in time.

Clustering dataset of clients to obtain time series in Python (or R)

I have a data of clients consumption in Bytes ( how much data every client consume when using wifi internet on a device like phone, computer, TV) every 6 minutes, we collect data on how much bytes have been consumed by every device at each client's home.
The data is being over one month, i want to extract times series of consumption for clients.
But first i need to classify clients that are active or non-active ( those who use certain devices unregulary or rarely) because they will cause noise. I also want to aggreagate the datetime variable to hourly by summing rxbytes in each hour.
| client mac adresse (wifi box) | device mac adresse | Type | rxbytes | date |
| -------- | -------------- | ------ | ------ | -----
| 10:06:45:BC:46:D0 | 58:00:E3:94:8B:FD | Mobile | 2104383| 2022-02-27 21:52:22
| 10:06:45:BC:46:D0 | 5C:3C:27:49:3C:42 | Mobile |2703456| 2022-02-27 21:58:22
| 10:06:45:BC:46:D0 | 5C:3C:27:49:3C:42 | Mobile |28848| 2022-02-27 22:04:22
.
.
.
| client mac adresse | device mac adresse | Type | rxbytes | date |
| -------- | -------------- | ------ | ------ | -----
| 35:06:45:BC:46:D0 | E2:4B:93:C8:64:C4 | Computer | 10415587| 2022-02-12 13:15:03
| 35:06:45:BC:46:D0 | E2:4B:93:C8:64:C4 | Computer |11523912| 2022-02-12 13:21:04
| 35:06:45:BC:46:D0 | E2:4B:93:C8:64:C4 | Computer |160192| 22022-02-12 13:27:03
.
.
ect.
all clients and their devices are in this table.

Getting physical address when you don't have the page in physical memory

For the record, this is homework.
I have a problem, where I have a processor that uses 32 bit virtual addresses and 32 bit physical addresses, with 4Kb pages and a linear page table.
I am given the following assembly instruction (MIPS32)
lw $t0, 0x34c8($zero)
Since, this processor uses 4Kb pages, the offset in the virtual address is 12 bits long, and therefore the last nibble in the address is the VPN (3). Using that to query the page table, I found that the PTE is an empty entry:
VPN | Dirty | Present | PPN
----------------------------
0 | 1 | 0 | 0x1
----------------------------
1 | 0 | 1 | 0x0
----------------------------
2 | 1 | 1 | 0x6
----------------------------
3 | - | 0 | -
----------------------------
4 | 0 | 1 | 0x4
----------------------------
5 | 0 | 1 | 0x2
----------------------------
6 | 0 | 1 | 0x7
----------------------------
7 | 0 | 1 | 0x3
How do I find the physical address, then? I'm told all physical pages in memory are in use, but I don't know if that helps. Am I supposed to assume the PPN is going to be 0x5, since that's the only "missing" page number not in the table?
Thanks.

if statement to check other rows - Google Docs

I have a spreadsheet along this format:
------------------------------------------------
| A | B | C | D |
------------------------------------------------
| type | wins | loss | ratio |
------------------------------------------------
| cat | 1 | | 1 |
------------------------------------------------
| dog | 2 | | 2 |
------------------------------------------------
| rabbit | | 1 | -1 |
------------------------------------------------
| dog | 1 | | 1 |
------------------------------------------------
| horse | 1 | | 1 |
------------------------------------------------
| dog | | 2 | -2 |
------------------------------------------------
What I want, is to check if the "A" column contains the word "dog" and if it does count the amount of times it has won in the table.
So, the formula would output:
dog total wins: 2
As it won the first time it appeared in the table and the second time it won too. If there is a winner the loss cell will be empty, and visa versa. I don't need it to add up the wins and give me the total sum.
Then, as a second part, I need it to give me the average ratio for "dog", so the formula needs to check if the "A" column contains "dog", if it does, it needs to add up all the "dog" ratios and divide by how many there are.
I have the formula to add up how many times "dog" appears, but the rest I'm stumped on!
=COUNTIF(A2:A;"dog")
Can anyone advise of the correct formula please?
I would do this:
FIRST PART:
=counta(filter(B:B,A:A="dog"))
SECOND PART:
=sum(filter(D:D,A:A="dog"))/countif(A:A;"dog")
Hope this helps.

Search for a specific text in a spreadsheet and sum up all these cells

I have a spreadsheet that looks like:
------------------
| A | B | C | D |
------------------
| 1 | 5 |bla |bla1|
------------------
| 2 |10 |bla2|bla2|
------------------
| 3 |10 |bla2|bla1|
------------------
| 4 | 5 |bla |bla2|
------------------
I want to sum up all cells in column B where the string bla2 is in column D and only in D and not in C. (So the sum should be 15.)
How would you do that in Google Spreadsheets?
=SUMIF(D:D,"bla2",B:B)
should work (same as Excel).

Resources