This will only work if your views use a naming convention that distinguishes them from tables and other objects.Īnother way to exclude views from your results is to query the sqlite_schema table directly. If you want to exclude views from your results, you could use pattern matching to exclude views. tables command returns both tables and views. In this case only tables that begin with the letter “a” are returned. For example, you can name a specific table, or you can use pattern matching to return only tables that match a given pattern. Such an argument can be used to limit the tables returned by the command. In my case, there’s only one attached database (the Chinook sample database), and all of this database’s tables are returned.Īs mentioned, you can also provide an argument to this command. Result: Album Employee InvoiceLine PlaylistTrack If you use it without providing an argument, it returns all tables (and views) for all attached databases. This command can be used with or without an argument. The easiest way to return a list of tables when using the SQLite command line shell is to use the. Update Dec 2021: Since writing this article, SQLite has introduced another option, which I’ve listed as a bonus third option at the end of this article. The second method gives you the option of returning both tables and views, or just tables, but only for the primary database. The first method returns all tables and views for all attached databases. Here are two ways to return a list of tables in all attached databases in SQLite.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |