Is it possible to have a mysql table refer to a table in a foreign database? - mysql4

Is it possible to use a mysql table transparently though the table is an alias for a table in a foreign database?

The standard doesn't support it, neither implementation of mysql db.

Related

Does QuestDB supports Foreign key, Primary key, references?

I wonder how db schema design would look, because at first glance I need bunch sql relation features, that are not available out of box in QuestDB.
No, QuestDB does not support PK, FK and any other constraints yet.
Schema can be same as other relational databases, except the PK values have to be generated by the application. QuestDB will not enforce uniqueness of values in a table column and uniqueness has to come from inserting application.

How many foreign keys can a table have in postgreSQL?

I am working on a Django project with a database in PostgreSQL. During my schema design, I have noticed that one table is referencing many foreign keys from other tables. Just curious that how many foreign keys can be referenced from/to one table? I also searched and found that the SQL server 2014 can reference up to253 foreign keys.
I don't think there is a hard limit. I just created a table with 10001 foreign key constraints.
Of course that doesn't mean that it is sane to define that many foreign keys, and performance will suffer considerably.

Django OneToOneField on foreign table

I'm trying to setup a new server with foreign tables (using postgres_fdw) that weren't foreign tables previously, and I have some OneToOneFields pointing to these tables. This doesn't work out of the box - OneToOneFields use foreign keys, and postgres_fdw does not support foreign keys for foreign tables.
The foreign tables are in a read-only database on the same server.
Is there an easy way to get this working?
After a little more research, I think the answer is 'don't do that'. Handling foreign keys for foreign tables isn't implemented, and any solution that tried to bridge that gap would have serious performance and/or consistency issues.
pglogical looks like a better solution - instead of pulling the data in through postgres_fdw, replicate the tables into the new database so they're local. There are other projects for replicating just specific tables, but pglogical is included with PostgreSQL 10.

What is difference between users_user_permissions and auth_permission and auth_group_permissions?

Django autogenerated above tables with syncdb, but I can't understand what are those tables for.
Sorry for silly question, but I'm just started with groups and permissions.
Django's scheme for automatically generating table names is explained here. Basically, it uses the pattern app_model. In the case of ManyToManyFields—which are implemented by creating a new table to hold the relationship—this becomes app_model1_model2s.
So:
auth_permission is the table that represents the auth.Permission model.
auth_group_permissions is the table that represents the ManyToMany relationship between auth.Group and auth.Permission.
users_user_permissions is the table that represents the ManyToManyField between users.User and auth.Permission. (I assume this is coming from an app you're using? Django's contrib.auth version should be auth_user_user_permissions.)
See the documentation for how these tables are actually used.

Sybase: how do I create data that violates foreign key contraint

I have an existing database with several rows that violate a foreign key constraint. How do I script this situation in a new database?
I believe some databases can create constraints that do not validate pre-existing data but cannot find this option in Sybase 12.
Sybase ASE 12.5
Adding a constraint doesn't validate against existing data.
So drop it, bob some garbage in and put it back...