JetBrains Rider/Intellij... Disabling database schema/table names being prepended with autocomplete
Preferences/Settings
Editor > General > Code Completion > SQL > Qualify object with > Table > Never.
Preferences/Settings
Editor > General > Code Completion > SQL > Qualify object with > Table > Never.
Don't waste time; here's the sample code with the Oracle database.
SELECT * FROM SampleTable WHERE sample_field in (7,3,4,6) ORDER BY INSTR(',7,3,4,6,', ',' || sample_field || ',');
You might be surprised why I am using MSYS2 so much these days. In short, my new job doesn't allow me to use Linux at work. I cannot bear the CMD.EXE and PWSH.EXE, they might be great tools for someone else, but definitely not for me.
/c/vagrant
, you will get the infamous Too many levels of symbolic links
error message. Fortunately, we have a solution: add a new user Environment variable MSYS=nonativeinnerlinks
. I assume you know how to add a user environment to the windows system. If it doesn't take effect, save your current work and reboot. I didn't reboot my Windows 11 VM, but I did have restarted the Windows terminal application to ensure the new MSYS2 terminal will work with the links!/c/Users/your-name
. If you copy from the following, don't forget to change david.wei
to your Windows username.$ cat /etc/nsswitch.conf
# Begin /etc/nsswitch.conf
passwd: db
group: db
db_enum: cache builtin
#db_home: cygwin desc
db_home: env windows /c/Users/david.wei
db_shell: cygwin desc
db_gecos: cygwin desc
# End /etc/nsswitch.conf
cmd.exe
in a msys2 terminal, that %PATH% environment will inherit from the PATH environment in the current bash session.export MSYS="winsymlinks:lnk"
into your .bashrc
to get a similar behaviour when you do ln -s
ReferenceMy colleage Joe asked me tonight, "how to remove those branches that no longer exist on remote?"
In short, you have two options
git remote prune origin
at timesgit config --global fetch.prune true
command to config your git to delete those branches every time when you run git fetch
I prefer the second option, how about you?
You want to add a unique index to a table, and unfortunately, there are already many duplicate rows in it. Manually find and delete these rows is time-wasting and error-prone. So why won't we just write one SQL statement and quickly resolve it?
First try, I wrote the following statement, and it won't work:
DELETE FROM PromotionSkus A
WHERE
A.SkuId IN (SELECT SkuId FROM PromotionSkus B GROUP BY B.SkuId HAVING COUNT(B.SkuId) > 1)
AND
A.Id NOT IN (SELECT MIN(Id) FROM PromotionSkus C GROUP BY C.SkuId HAVING COUNT(C.SkuId) > 1);
AND this one below works!
DELETE FROM PromotionSkus A
WHERE
A.Id NOT IN (SELECT Id FROM (SELECT MIN(Id) AS Id, COUNT(SkuId) AS Total FROM PromotionSkus GROUP BY SkuId HAVING Total > 1) AS B)
AND
A.SkuId IN (SELECT SkuId FROM (SELECT SkuId FROM PromotionSkus GROUP BY SkuId HAVING COUNT(SkuId) > 1) AS C);
The reason is well explained in this brilliant article.
Another mysql tip: using mysqldump export a table with one line one row.
mysqldump --databases YourDataBaseName --tables YourTableName --skip-extended-insert
Why do we need that? It is much easier to compare !