Below are four ways to list out the views in a MariaDB database using SQL or the command line.
Continue readingTag: views
How to List All Views in a PostgreSQL Database
In PostgreSQL, we can use the information_schema.views
view to return all views in a database.
We can also use the \dv
psql command to do the same thing.
4 Ways to List the Views in an SQLite Database
Here are four options for showing all views within an SQLite database.
Continue readingHow to List All Views in Oracle Database
You can use the following views to return a list of views in Oracle Database.
Continue reading4 Ways to List All Views in MySQL
Below are four ways to list out the views in a MySQL database using SQL or the command line.
Continue readingGet the Underlying Columns of a View Based on its Result Set
One of the great things about database views, is that they allow you to run complex queries without needing to know the underlying database schema.
Yes, it’s true that you need to know the underlying schema when you create the view, but you only need to do that once. Once you’ve created it, you can query that view all day long without needing to remember all the table and column names, etc.
Views typically combine data from multiple tables into a single, virtual table, which makes it kind of like a “black box”. As long as it works as designed, you don’t need to concern yourself with the hidden details.
But what if you do want to check a view for its underlying tables and columns?
Continue readingHow to Convert a MongoDB View to a Collection
If you have a view in a MongoDB database that you’d prefer to be a collection, you’re in the right place.
Below is an example of converting a view to a collection in MongoDB.
Continue readingHow to Encrypt a View in SQL Server
In SQL Server, you can encrypt a view at the time you first create it, or you can alter it later to include encryption.
To create a view with T-SQL, you use the CREATE VIEW
syntax. To encrypt it, you add the WITH ENCRYPTION
argument.
You can also use the same argument to encrypt an existing view when using ALTER VIEW
.
Remove SCHEMABINDING from a View in SQL Server
The purpose of schema binding a view is to ensure that the base tables referenced in the view cannot be modified in a way that would affect the view definition.
This is normally a good thing. After all, you don’t want someone coming along and dropping a table that your view depends on, do you?
But what if you need to make changes to one or more tables referenced by your view?
Create a Schema Bound View in SQL Server
It’s usually a good idea to schema bind your views in SQL Server.
Schema binding your view will ensure that the underlying tables can’t be changed in a way that would affect the view. Without schema binding, the underlying tables or other objects could be modified or even deleted. If that happens, the view will no longer work as expected.