1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-16 13:38:02 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Irbaz Ahmed
79ae007109 Merge 69917e4c93 into e91b163571 2024-06-20 14:15:46 +00:00
jbranchaud
e91b163571 Add Echo A Message From A SQL File as a MySQL TIL 2024-05-31 10:07:23 -05:00
IA21
69917e4c93 Update chrome/duplicate-the-current-tab.md
Co-authored-by: Michael Currin <18750745+MichaelCurrin@users.noreply.github.com>
2021-05-11 15:38:18 +05:00
IA21
c79e4c45bf Cmd+Enter does not work on Chrome in Windows
Alt+Enter does and has been added to the file.
2020-04-19 20:23:55 +05:00
3 changed files with 35 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1433 TILs and counting..._
_1434 TILs and counting..._
---
@@ -607,6 +607,7 @@ _1433 TILs and counting..._
- [Display Output In A Vertical Format](mysql/display-output-in-a-vertical-format.md)
- [Doing Date Math](mysql/doing-date-math.md)
- [Dump A Database To A File](mysql/dump-a-database-to-a-file.md)
- [Echo A Message From A SQL File](mysql/echo-a-message-from-a-sql-file.md)
- [Ignore Duplicates When Inserting Records](mysql/ignore-duplicates-when-inserting-records.md)
- [List Databases And Tables](mysql/list-databases-and-tables.md)
- [Run Statements In A Transaction](mysql/run-statements-in-a-transaction.md)

View File

@@ -4,7 +4,7 @@ Sometimes when viewing a page, you realize you want to keep that page open
but also go back to the previous page to view something else. An easy way of
achieving this is to duplicate the current tab and then go back.
To duplicate the current tab hit `Cmd+Enter` while the focus is on the URL
To duplicate the current tab, hit `Cmd+Enter` (macOS) or `Alt+Enter` (Windows) while the focus is on the URL
bar.
If the URL bar is not in focus, then first hit `Cmd+L` to focus followed by

View File

@@ -0,0 +1,32 @@
# Echo A Message From A SQL File
Let's say we have a SQL file that we run to seed our database. We want to echo
a message to stdout at the beginning of that file's execution. We can do this
with [a MySQL client _shell
command_](https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-commands.html).
Specifically, we need to use the `\system` or `\!` command to run our system's
`echo` command.
Here is what that could look like:
```sql
\! echo '*****************************************'
\! echo '* *'
\! echo '* Loading seed data into the database *'
\! echo '* *'
\! echo '*****************************************'
insert into products ...
```
That message banner will be output when you run the script.
```bash
$ mysql -h ::1 -P 3306 -u root -D local_database < seed_data.sql
*****************************************
* *
* Loading seed data into the database *
* *
*****************************************
```