Is mysql is different than sql?

|
israeldieguez 2021-05-25 13:25:13
Hi.
israeldieguez 2021-05-25 13:25:46
I am new here, and I would like to participate about this MySQL channel.
israeldieguez 2021-05-25 14:03:20
I am trying to copy a mysql to another mysql. So, I export all databases via mysqldump. And I import its via mysql -uuser -ppassword < file.sql

However, sometimes I get errors when it’s trying to create views with references to another databases that it’s not created yet. How can I disable this checking?

SET FOREIGN_KEY_CHECKS = 0 doesn’t help…

MasterZiv 2021-05-25 15:39:42
israeldieguez 2021-05-25 14:03:20
I am trying to copy a mysql to another mysql. So, I export all databases via mysqldump. And I import its via mysql -uuser -ppassword < file.sql

However, sometimes I get errors when it’s trying to create views with references to another databases that it’s not created yet. How can I disable this checking?

SET FOREIGN_KEY_CHECKS = 0 doesn’t help…

You cannot disable this.
Just ignore the errors, or export ALL databases.

israeldieguez 2021-05-25 16:45:10
MasterZiv 2021-05-25 15:39:42
You cannot disable this.
Just ignore the errors, or export ALL databases.

If I export (dump) with “–all-databases” instead of “–database DatabaseName”, I imagine that I will have same problem, right? Or the dump first create tables and then create views? My mysql have more than 150 gigas and every check it takes some hours and I can’t analize the content of .sql files.

MasterZiv 2021-05-25 17:25:59
israeldieguez 2021-05-25 16:45:10
If I export (dump) with “–all-databases” instead of “–database DatabaseName”, I imagine that I will have same problem, right? Or the dump first create tables and then create views? My mysql have more than 150 gigas and every check it takes some hours and I can’t analize the content of .sql files.

No, not necessary.

MasterZiv 2021-05-25 17:29:08
israeldieguez 2021-05-25 16:45:10
If I export (dump) with “–all-databases” instead of “–database DatabaseName”, I imagine that I will have same problem, right? Or the dump first create tables and then create views? My mysql have more than 150 gigas and every check it takes some hours and I can’t analize the content of .sql files.

I can’t analize the content of .sql files.

You must. Or as alternative you should know your DB like the back of your hand

israeldieguez 2021-05-25 17:41:18
Thanks Ilia. I will try to dump with –all-databases option.

About to know the database, you are right. However, for this project, there is no DBA. In fact, we are all developers, and I am trying to help while we receive a colleague to help the team.

Thank you very much.

MasterZiv 2021-05-25 17:42:26
israeldieguez 2021-05-25 17:41:18
Thanks Ilia. I will try to dump with –all-databases option.

About to know the database, you are right. However, for this project, there is no DBA. In fact, we are all developers, and I am trying to help while we receive a colleague to help the team.

Thank you very much.

DBA is a less professional qualification, so you must be able to do it.

Mohd Ibraheem Patel 2021-05-25 17:42:46
Is mysql is different than sql? Plsql?
israeldieguez 2021-05-26 00:43:57
Mohd Ibraheem Patel 2021-05-25 17:42:46
Is mysql is different than sql? Plsql?

Hi Mohd. SQL is the language to speak with any database system. PL-SQL is a more advanced language than SQL, only available in ORACLE. ORACLE and MySQL (among others) are database servers / systems.

Murali 2021-05-26 09:00:24
Friends..how to disable binary logs in MySQL 8 on windows
piterden 2021-05-26 09:39:48
Murali 2021-05-26 09:00:24
Friends..how to disable binary logs in MySQL 8 on windows

Try to edit config and restart the server

Murali 2021-05-26 09:57:50
Done but same result
piterden 2021-05-26 10:38:18
Murali 2021-05-26 09:57:50
Done but same result

It means you haven’t done it

Murali 2021-05-26 10:39:08
I’ve mentioned disable-bin-log
MasterZiv 2021-05-26 11:39:29
Murali 2021-05-26 09:57:50
Done but same result

without details this can’t be solved.

rodrigo_tc7 2021-05-26 12:02:49
Hello, i have a difficult task to be resolved with one complex query (i think)

– I’m going to over simplify my tables for this example
– I have two tables “origin” and “current”
they may have some fields in common
sometimes i have the id field, wich is great, and sometimes i need to use alternative field/s to match both tables.
– I need to try every posible match and also the “no match” option
– I need to give priority to the better matching mechanism

So:
– I’ve made a union query to get every posible matching and use a “score” field:
select “1” as score, some-fields
from origin join current on origin.id = current.id

union

select “2” as score, some-fields
from origin join current on origin.field_x = current.field_y and blah blah

union

select “99” as score, some-fields
from origin
left join current on current.id = “non existing value”

order by origin.id, score

– And now i need to keep the first (lower score) records and remove every other one in the result
i must keep every “1” score row and also every “2” score row in case that i don’t have a “1” score row for that id… the same goes for every row if it has the lowest score for that id
Any ideas?

MasterZiv 2021-05-26 12:45:05
rodrigo_tc7 2021-05-26 12:02:49
Hello, i have a difficult task to be resolved with one complex query (i think)

– I’m going to over simplify my tables for this example
– I have two tables “origin” and “current”
they may have some fields in common
sometimes i have the id field, wich is great, and sometimes i need to use alternative field/s to match both tables.
– I need to try every posible match and also the “no match” option
– I need to give priority to the better matching mechanism

So:
– I’ve made a union query to get every posible matching and use a “score” field:
select “1” as score, some-fields
from origin join current on origin.id = current.id

union

select “2” as score, some-fields
from origin join current on origin.field_x = current.field_y and blah blah

union

select “99” as score, some-fields
from origin
left join current on current.id = “non existing value”

order by origin.id, score

– And now i need to keep the first (lower score) records and remove every other one in the result
i must keep every “1” score row and also every “2” score row in case that i don’t have a “1” score row for that id… the same goes for every row if it has the lowest score for that id
Any ideas?

It was a bad idea doing this task this way.

MasterZiv 2021-05-26 12:47:16
rodrigo_tc7 2021-05-26 12:02:49
Hello, i have a difficult task to be resolved with one complex query (i think)

– I’m going to over simplify my tables for this example
– I have two tables “origin” and “current”
they may have some fields in common
sometimes i have the id field, wich is great, and sometimes i need to use alternative field/s to match both tables.
– I need to try every posible match and also the “no match” option
– I need to give priority to the better matching mechanism

So:
– I’ve made a union query to get every posible matching and use a “score” field:
select “1” as score, some-fields
from origin join current on origin.id = current.id

union

select “2” as score, some-fields
from origin join current on origin.field_x = current.field_y and blah blah

union

select “99” as score, some-fields
from origin
left join current on current.id = “non existing value”

order by origin.id, score

– And now i need to keep the first (lower score) records and remove every other one in the result
i must keep every “1” score row and also every “2” score row in case that i don’t have a “1” score row for that id… the same goes for every row if it has the lowest score for that id
Any ideas?

Just write one left join.

From origin left join current on … Mandatory matching conditions here….

And add this ranking of match in WHERE

MasterZiv 2021-05-26 12:48:15
MasterZiv 2021-05-26 12:47:16
Just write one left join.

From origin left join current on … Mandatory matching conditions here….

And add this ranking of match in WHERE

Or probably use window functions and filter by them

rodrigo_tc7 2021-05-26 13:16:44
thank you @MasterZiv
rodrigo_tc7 2021-05-26 13:17:54
MasterZiv 2021-05-26 12:45:05
It was a bad idea doing this task this way.

Is a requeriment 🙁

rodrigo_tc7 2021-05-26 13:18:26
MasterZiv 2021-05-26 12:47:16
Just write one left join.

From origin left join current on … Mandatory matching conditions here….

And add this ranking of match in WHERE

i don’t understand how to add the ranking here

MasterZiv 2021-05-26 13:24:38
rodrigo_tc7 2021-05-26 13:17:54
Is a requeriment 🙁

it cna’t be req as this is how you do this, not what you do

rodrigo_tc7 2021-05-26 13:38:13
i mean, i should get a solution using queries, not procedures or programming
UnknownError417 2021-05-26 13:46:26
Hey guys what’s the best database solution for an app that handles videos and complex searches
MasterZiv 2021-05-26 13:49:40
UnknownError417 2021-05-26 13:46:26
Hey guys what’s the best database solution for an app that handles videos and complex searches

How are you going to search video “files” ?

UnknownError417 2021-05-26 13:50:10
Well it’s kinda like LinkedIn and Instagram.

LinkedIn – tags based searches
Instagram – videos and pictures

UnknownError417 2021-05-26 13:51:45
I’m a UX designer and I’m not very technically versed. I understand the choices are between Cassandra, MondoDB and SQL
MasterZiv 2021-05-26 13:52:21
rodrigo_tc7 2021-05-26 13:38:13
i mean, i should get a solution using queries, not procedures or programming

write a big CASE expression calculating rank, add order by some basic fields and the rang,
use a cursor running over this query and choosing one or several records in a group by the rang.

MasterZiv 2021-05-26 13:54:13
UnknownError417 2021-05-26 13:50:10
Well it’s kinda like LinkedIn and Instagram.

LinkedIn – tags based searches
Instagram – videos and pictures

So, in a DB you will store path to video and its TAGS and other attributes, NOT the video itself.
Then ANY DBMS will be able to handle this data

rodrigo_tc7 2021-05-26 14:44:11
MasterZiv 2021-05-26 13:52:21
write a big CASE expression calculating rank, add order by some basic fields and the rang,
use a cursor running over this query and choosing one or several records in a group by the rang.

Thank you, i’ll check that cursor approach

MasterZiv 2021-05-26 14:55:07
rodrigo_tc7 2021-05-26 14:44:11
Thank you, i’ll check that cursor approach

Or you can try this https://dev.mysql.com/doc/refman/8.0/en/window-functions.html

rodrigo_tc7 2021-05-26 14:58:02
seems cool, but i’m stuck at 5.7 version by now
|