Get the App
SLTechnology News&Howtos  ›  Database  › 

How to understand the short SQL in Oracle and MySQL

Shulou Source: shulou.com Published: 2022-05-31 14:09:49 10月03日 Update

This article will explain in detail how to understand the short SQL in Oracle and MySQL. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

If you were asked to write a simple and awesome SQL, regardless of the database type, what kind of SQL statement would you write?

Oracle

If it's Oracle, I'll write a drop table dual.

This SQL looks very simple, contains a large amount of information, first of all, you have to have some understanding and understanding of the dual table, and this view is different from the general data dictionary, if deleted, it will directly lead to the database unavailable. Recovery requires an implicit parameter to adjust.

Of course, if you want to write some SQL with philosophy of life from a different point of view, it will take a lot of work.

I thought of one, such as Flashback database to sysdate-1/24/60.

What I'm trying to say is that the database can flash back to a minute ago, and our lives won't, none of them.

MySQL

I really thought a lot about writing a few SQL in this respect from the perspective of MySQL, but I didn't feel very satisfied until I saw a MySQL performance test statement provided by jeremycole, which was simple but powerful.

Https://github.com/jeremycole/yesmark can be seen on github

Statement on one line:

Yes "DO 0;" | mysql > / dev/null &

If you want to open a parallel, that's not a problem, such as 16 concurrency.

For i in {1... 16}; do yes "DO 0;" | mysql > / dev/null & done

Such sentences are really short and concise.

On how to understand Oracle and MySQL in the short SQL to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Data sentences concise short database life content articles more knowledge articles angles different good large one line things information amount of information kung fu Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker MySQL Huawei Apple Linux