New answers tagged

1

As you ask specifically for a RegEx solution, let's start with SELECT text_1, text, REGEXP_REPLACE(nvl(l.text_1, l.text), '^'||21810||'=|\|'||21810||'=', '|'||21810||'='||'B1' ) as checked, REGEXP_REPLACE(nvl(l.text_1, l.text), '^(\d+=)C1(\|\|21810=)C2', '\1\2B1' ...


0

That's not the correct syntax for using a cursor. But why even use a cursor when JOIN will do the job much faster. Or a GROUP_CONCAT. BEGIN SELECT CM.career_id AS id, CM.name AS career, AC.name AS area, GROUP_CONCAT(sd.name FROM specialization_detail WHERE sd.career_id = row.id) FROM ...


0

Why track them? If it is to see everything that is happening, use the general log. If it is looking for performance issues, use the slowlog. Neither the general nor slow logs limit output to specific table(s). The Audit plugin, if available, is probably better for the former case. Various "proxy" products could sit between clients and the server; ...


0

You can do it using MySQL AUDIT PLUGIN (Requires license) [["filter": { "class": { "name": "table_access", "event": { "name": [ "insert", "update", "delete" ], "abort": { "and": [ { "field": { "name": "table_database.str"...


2

If your interface allows you to get the results in a hash (associative array), then SELECT * should be just fine when you need all the columns. The other answers point out why SELECT * is likely to bite you in the future. I agree with them. The Optimizer turns SELECT * into SELECT col1, ... before performing the query, so there is essentially no performance ...


3

As you need all columns, make a SELECt Col1,col3..... so that is clear that you need all. In future times, when you view your queries, and you need to figure pit what you have done 5 years ago, it helps to know which columns you select because structures and requirements change, and you must add new columns to the table, you would need more and more ...


18

There's a third option you forgot to mention, make one DB call, with SELECT COLUMN_LIST. The reason I mention this is because the comparison of when to use SELECT * vs SELECT COLUMN_LIST isn't really about how many database calls one makes, rather it's about schema consistency. The reason SELECT * is recommended against is because the schema of the dataset ...


Top 50 recent answers are included