Last active
June 9, 2024 21:52
-
-
Save RodrigoMattosoSilveira/4664d600707ec41947e083e1e24b20a9 to your computer and use it in GitHub Desktop.
Execute SQL statements from a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Execute SQL statements from a file | |
Suppose we have a file named commands.txtin the c:\sqlite\folder with the following content: | |
``` | |
SELECT albumid, title | |
FROM albums | |
ORDER BY title | |
LIMIT 10; | |
Code language: Shell Session (shell) | |
``` | |
To execute the SQL statements in the commands.txtfile, you use the .read FILENAMEcommand as follows: | |
``` | |
sqlite> .mode column | |
sqlite> .header on | |
sqlite> .read c:/sqlite/commands.txt | |
AlbumId Title | |
---------- ---------------------- | |
156 ...And Justice For All | |
257 20th Century Masters - | |
296 A Copland Celebration, | |
94 A Matter of Life and D | |
95 A Real Dead One | |
96 A Real Live One | |
285 A Soprano Inspired | |
139 A TempestadeTempestade | |
203 A-Sides | |
160 Ace Of Spades | |
Code language: Shell Session (shell) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment