Underated database trick #database #sql #mysql #webdevelopment #programming #coding

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Also if you ever want to update or delete data, write it as a select statement first so you can see what is about to happen. Then change to update/delete with the same where conditions etc.

fredrikhult
Автор

I would t call this underrated usage - it is THE reason transactions exists. To rollback when something went wrong. Either from the terminal or from logic within your app.

xandrios
Автор

It's not a trick it's a serious database concept. Transactions and rollback.

masterchief
Автор

please also mention that you not only "can" commit the transaction, you "have to" commit or rollback the transaction or you can block your entire database and everyone has to wait on your open transaction. oh boy, you will not have fun when this happens xD

Nobody-prri
Автор

Just be careful as you can be locking large amounts of data until you complete your transaction.

LogicalNiko
Автор

I can hear Tom Scott screaming in the background 😂

jehadnasereddin
Автор

in a tik tok era we watch vertical videos about main features of our technologies as it’s something exceptional. ok.

Veujin
Автор

I didn't know you can do this via the terminal. This can save a life 😅

umarmuhammadzakari
Автор

Yeah this is a good call. My "trick" is "no updates or deletes without a where clause." Write the where clause first, then the first part of the statement

mickmister
Автор

Good suggestion

In such cases i always write where clause first, and than come to update, to accidenntly not run the wrong SQL.

shoaibbagdadi
Автор

This is one of the reasons I love relational databases. They are magical.

JuanMoisesTorrijos
Автор

How is this underrated? I get asked about this in every single interview I attend

anandxs
Автор

Bro just did SQL 101 and had his mind blown 😂

sharpt-
Автор

It works only if you have low load application. Otherwise it is probably the best way to lock entire table and hang your application!

unixway
Автор

You always have the most interesting and coolest tricks! Love your channel!

BlueBearOne
Автор

The correct answer is NEVER run sql commands against a live database.

SteepiBlanphe
Автор

Problem is, those who will write code without a where query will also execute commit immediately after execution.. 😂😂

Jashobantac
Автор

In an interview for an MS SQL job, the first line was begin tran and then I ran an update statement. One of the interviewers in the room said she hadn't known about that and that she learned something. The sad thing is that I still didn't get the job.

chrismcdonnell
Автор

That's why people usually don't have access to the sql. You are locking maybe entire tables just trying to figure out what to do. Develop, test and just go to production for execution.

ldelossantos
Автор

One thing that is really frustrating about MySQL is that transactions do not apply to DDL statements like ALTER TABLE. This is unlike many other providers like Postgres, MS SQL Server or even sqlite.

AlexanderKrivacsSchrder