Yes you can access a database from a UWP. Would I recommend it no. It would be better to create a web service for getting or saving the data from the database and have your UWP use the service. It makes the database safer.
Another choice is to use a .net 5 wpf or windows forms app. You can compile it into a single file app.
https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file