How many rows this query takes from the table in terms of percent of rows taken to the whole number of rows?

|
marko2202 2020-10-08 20:21:41
Hello everybody

What means key word distinct in SQL?

2020-10-08 20:26:53
piterden 2020-10-07 19:08:05
What you mean?

telegram grps related to artificial intelligence

2020-10-08 20:26:59
marko2202 2020-10-08 20:21:41
Hello everybody

What means key word distinct in SQL?

go to sqlbolt.com and learn it

2020-10-08 20:27:05
it means only once
2020-10-08 20:27:13
used with aggregate fxns
piterden 2020-10-08 23:45:26
marko2202 2020-10-08 20:21:41
Hello everybody

What means key word distinct in SQL?

It means to get unique records

piterden 2020-10-08 23:46:34
piterden 2020-10-08 23:45:26
It means to get unique records

Or maybe it’d be better to say not repeat

MasterZiv 2020-10-09 00:35:57
2020-10-08 20:27:13
used with aggregate fxns

No, distinct is not used with aggregate functions

alexsandro_matias 2020-10-09 01:16:46
I’m trying improve the time os queries using indexes. For example :

SELECT
L_RETURNFLAG,
L_LINESTATUS,
SUM(L_QUANTITY) AS SUM_QTY,
SUM(L_EXTENDEDPRICE) AS SUM_BASE_PRICE,
SUM(L_EXTENDEDPRICE * (1 – L_DISCOUNT)) AS SUM_DISC_PRICE,
SUM(L_EXTENDEDPRICE * (1 – L_DISCOUNT) * (1 + L_TAX)) AS SUM_CHARGE,
AVG(L_QUANTITY) AS AVG_QTY,
AVG(L_EXTENDEDPRICE) AS AVG_PRICE,
AVG(L_DISCOUNT) AS AVG_DISC,
COUNT(*) AS COUNT_ORDER
FROM
LINEITEM
WHERE
L_SHIPDATE <= DATE ‘1998-12-01’ – INTERVAL ‘108’ DAY
GROUP BY
L_RETURNFLAG,
L_LINESTATUS
ORDER BY
L_RETURNFLAG,
L_LINESTATUS;

alexsandro_matias 2020-10-09 01:17:04
mysql_en-6318.jpg

piterden 2020-10-09 02:39:07
alexsandro_matias 2020-10-09 01:16:46
I’m trying improve the time os queries using indexes. For example :

SELECT
L_RETURNFLAG,
L_LINESTATUS,
SUM(L_QUANTITY) AS SUM_QTY,
SUM(L_EXTENDEDPRICE) AS SUM_BASE_PRICE,
SUM(L_EXTENDEDPRICE * (1 – L_DISCOUNT)) AS SUM_DISC_PRICE,
SUM(L_EXTENDEDPRICE * (1 – L_DISCOUNT) * (1 + L_TAX)) AS SUM_CHARGE,
AVG(L_QUANTITY) AS AVG_QTY,
AVG(L_EXTENDEDPRICE) AS AVG_PRICE,
AVG(L_DISCOUNT) AS AVG_DISC,
COUNT(*) AS COUNT_ORDER
FROM
LINEITEM
WHERE
L_SHIPDATE <= DATE ‘1998-12-01’ – INTERVAL ‘108’ DAY
GROUP BY
L_RETURNFLAG,
L_LINESTATUS
ORDER BY
L_RETURNFLAG,
L_LINESTATUS;

And what?

alexsandro_matias 2020-10-09 02:46:49
HAVE U SOME IDEA ???
piterden 2020-10-09 02:50:50
alexsandro_matias 2020-10-09 02:46:49
HAVE U SOME IDEA ???

What about?

alexsandro_matias 2020-10-09 02:51:17
choose the indexes. I tried but so sucess
piterden 2020-10-09 02:52:09
You have math operations
drfibonacci 2020-10-09 06:13:56
alexsandro_matias 2020-10-09 01:16:46
I’m trying improve the time os queries using indexes. For example :

SELECT
L_RETURNFLAG,
L_LINESTATUS,
SUM(L_QUANTITY) AS SUM_QTY,
SUM(L_EXTENDEDPRICE) AS SUM_BASE_PRICE,
SUM(L_EXTENDEDPRICE * (1 – L_DISCOUNT)) AS SUM_DISC_PRICE,
SUM(L_EXTENDEDPRICE * (1 – L_DISCOUNT) * (1 + L_TAX)) AS SUM_CHARGE,
AVG(L_QUANTITY) AS AVG_QTY,
AVG(L_EXTENDEDPRICE) AS AVG_PRICE,
AVG(L_DISCOUNT) AS AVG_DISC,
COUNT(*) AS COUNT_ORDER
FROM
LINEITEM
WHERE
L_SHIPDATE <= DATE ‘1998-12-01’ – INTERVAL ‘108’ DAY
GROUP BY
L_RETURNFLAG,
L_LINESTATUS
ORDER BY
L_RETURNFLAG,
L_LINESTATUS;

For query operations, you generally have indexes to reduce time taken for comparisons or full table lookups

drfibonacci 2020-10-09 06:14:57
I see that you are comparing the L_SHIPDATE field a couple of times
drfibonacci 2020-10-09 06:16:13
The rest of your query is supposed to work on the whole dataset(mostly sum and average), so having indexes on those fields probably would not make much difference
drfibonacci 2020-10-09 06:17:11
I suggest you create an index on the L_SHIPDATE field and then see if there are improvements in the fetch
jacob_joelin 2020-10-09 07:11:02
mysql_en-6330.jpg

jacob_joelin 2020-10-09 07:11:30
What would be the query for that pcode_pquantity column
MasterZiv 2020-10-09 07:32:36
alexsandro_matias 2020-10-09 01:16:46
I’m trying improve the time os queries using indexes. For example :

SELECT
L_RETURNFLAG,
L_LINESTATUS,
SUM(L_QUANTITY) AS SUM_QTY,
SUM(L_EXTENDEDPRICE) AS SUM_BASE_PRICE,
SUM(L_EXTENDEDPRICE * (1 – L_DISCOUNT)) AS SUM_DISC_PRICE,
SUM(L_EXTENDEDPRICE * (1 – L_DISCOUNT) * (1 + L_TAX)) AS SUM_CHARGE,
AVG(L_QUANTITY) AS AVG_QTY,
AVG(L_EXTENDEDPRICE) AS AVG_PRICE,
AVG(L_DISCOUNT) AS AVG_DISC,
COUNT(*) AS COUNT_ORDER
FROM
LINEITEM
WHERE
L_SHIPDATE <= DATE ‘1998-12-01’ – INTERVAL ‘108’ DAY
GROUP BY
L_RETURNFLAG,
L_LINESTATUS
ORDER BY
L_RETURNFLAG,
L_LINESTATUS;

How many rows this query takes from the table in terms of percent of rows taken to the whole number of rows?

What is the ratio number of stores taken to tool rows in the table?

MasterZiv 2020-10-09 07:35:03
jacob_joelin 2020-10-09 07:11:30
What would be the query for that pcode_pquantity column

This is a json field.
Should not be used actually

MasterZiv 2020-10-09 07:39:08
alexsandro_matias 2020-10-09 01:16:46
I’m trying improve the time os queries using indexes. For example :

SELECT
L_RETURNFLAG,
L_LINESTATUS,
SUM(L_QUANTITY) AS SUM_QTY,
SUM(L_EXTENDEDPRICE) AS SUM_BASE_PRICE,
SUM(L_EXTENDEDPRICE * (1 – L_DISCOUNT)) AS SUM_DISC_PRICE,
SUM(L_EXTENDEDPRICE * (1 – L_DISCOUNT) * (1 + L_TAX)) AS SUM_CHARGE,
AVG(L_QUANTITY) AS AVG_QTY,
AVG(L_EXTENDEDPRICE) AS AVG_PRICE,
AVG(L_DISCOUNT) AS AVG_DISC,
COUNT(*) AS COUNT_ORDER
FROM
LINEITEM
WHERE
L_SHIPDATE <= DATE ‘1998-12-01’ – INTERVAL ‘108’ DAY
GROUP BY
L_RETURNFLAG,
L_LINESTATUS
ORDER BY
L_RETURNFLAG,
L_LINESTATUS;

L_shipdate here is a potential field for the index, but you have an open interval got your condition, it potentially can take big part of the table and hence this index is going to be useless

MasterZiv 2020-10-09 09:07:39
jacob_joelin 2020-10-09 07:11:30
What would be the query for that pcode_pquantity column

This must be master-detail implemented as a JSON field, that is complete nonsense!

I have seen many DB design mistakes, but I see something like this for the first time in my 20+ year career! This is full , complete, ultimate f@ck up !
Go running to redesign your DB!

MasterZiv 2020-10-09 09:09:38
jacob_joelin 2020-10-09 07:11:30
What would be the query for that pcode_pquantity column

What was your question BTW?

jacob_joelin 2020-10-09 09:14:06
It is written above
drfibonacci 2020-10-09 09:15:25
jacob_joelin 2020-10-09 07:11:30
What would be the query for that pcode_pquantity column

You can find everything here

https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html

MasterZiv 2020-10-09 09:25:44
jacob_joelin 2020-10-09 09:14:06
It is written above

First, when you answer, use “reply” command, by this the one you reply to can be notified.

Second, your question is unclear, you already have the query by which you already have got the field. So what you need is unclear

2020-10-09 11:02:02
i need algorithms help.
2020-10-09 12:07:51
i can’t code bfs
MasterZiv 2020-10-09 14:04:45
2020-10-09 11:02:02
i need algorithms help.

Ask a detailed questions, please

iamshameer 2020-10-09 17:27:30
Hi I am new to MySQL
iamshameer 2020-10-09 17:27:58
I have installed one MySQL community editio. In one server
iamshameer 2020-10-09 17:28:28
I want to connect the MySQL from second server which doesn’t have MySQL installed
iamshameer 2020-10-09 17:28:46
Can any one tell me how to acess ?
MasterZiv 2020-10-09 17:41:02
iamshameer 2020-10-09 17:28:46
Can any one tell me how to acess ?

You must install MySQL client on that host, and then you will be able to connect

2020-10-10 14:44:00
MasterZiv 2020-10-09 14:04:45
Ask a detailed questions, please

how is the space complexity of DFS bm+1? can you show me websites which have solved it?

2020-10-10 14:44:16
iamshameer 2020-10-09 17:27:58
I have installed one MySQL community editio. In one server

i will share you 1 video.

2020-10-10 14:45:12
https://www.youtube.com/watch?v=0CcHAZ6L00U

MYSQL introduction | Learn how to install and run MySQL in systemYouTube
Hello everyone, mysql introdution is my first youtube video uploaded in this channel. In this channel i will be uploading a series of video related mysql and…
2020-10-10 14:45:17
it helped me to install.
MasterZiv 2020-10-10 16:22:36
2020-10-10 14:44:00
how is the space complexity of DFS bm+1? can you show me websites which have solved it?

What is DFS bm+1 ?

2020-10-10 16:22:56
depth first search space complexity=b*m+1
2020-10-10 16:22:57
how?
MasterZiv 2020-10-10 16:23:18
2020-10-10 16:22:56
depth first search space complexity=b*m+1

How MySQL is related to this?

2020-10-10 16:23:29
any algorithms groups in telegram?
MasterZiv 2020-10-10 16:24:18
2020-10-10 16:22:56
depth first search space complexity=b*m+1

I think it should be O(N), because you need to store path stack

2020-10-10 16:24:38
no idea myself.
MasterZiv 2020-10-11 09:24:41
You can look for it in Kormen’s book
2020-10-11 10:00:44
Not there.
|