MySQL CREATE VIEW targeting variable table name (columns names)Swapping column values in MySQLHow do I quickly rename a MySQL database (change schema name)?What is the naming convention in Python for variable and function names?How do you set a default value for a MySQL Datetime column?How to find all the tables in MySQL with specific column names in them?MySQL: @variable vs. variable. What's the difference?How to import CSV file to MySQL tableInsert into a MySQL table or update if existsHow to get the sizes of the tables of a MySQL database?How to reference a just created column in mysql view?
What's the big deal about the Nazgûl losing their horses?
When moving a unique_ptr into a lambda, why is it not possible to call reset?
Examples of fluid (including air) being used to transmit digital data?
Was it ever illegal to name a pig "Napoleon" in France?
Quotients of a ring of integers
How can I use my cell phone's light as a reading light?
Why is there paternal, for fatherly, fraternal, for brotherly, but no similar word for sons?
Who goes first? Person disembarking bus or the bicycle?
Is it ok for parents to kiss and romance with each other while their 2- to 8-year-old child watches?
Wouldn't putting an electronic key inside a small Faraday cage render it completely useless?
Why am I getting unevenly-spread results when using $RANDOM?
Attach a visible light telescope to the outside of the ISS
Which is a better conductor, a very thick rubber wire or a very thin copper wire?
When is one 'Ready' to make Original Contributions to Mathematics?
Gory anime with pink haired girl escaping an asylum
My professor has told me he will be the corresponding author. Will it hurt my future career?
Why do people prefer metropolitan areas, considering monsters and villains?
Why does "mi piace" mean "I like" instead of "he/she/it likes me"?
As a supervisor, what feedback would you expect from a PhD who quits?
Taking my Ph.D. advisor out for dinner after graduation
Did William Shakespeare hide things in his writings?
WPF Palindrome Checker Application
How should I ask for a "pint" in countries that use metric?
How does the cloaker's Phantasms action work?
MySQL CREATE VIEW targeting variable table name (columns names)
Swapping column values in MySQLHow do I quickly rename a MySQL database (change schema name)?What is the naming convention in Python for variable and function names?How do you set a default value for a MySQL Datetime column?How to find all the tables in MySQL with specific column names in them?MySQL: @variable vs. variable. What's the difference?How to import CSV file to MySQL tableInsert into a MySQL table or update if existsHow to get the sizes of the tables of a MySQL database?How to reference a just created column in mysql view?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to define a lot of views but the model of the DB is changing so there are some ideas/questions that came to my mind:
Is there any way in MySQL 8 to create view that after FROM has not hardcoded table name but table name is a variable?
Is it possible to create view that has hardcoded name of table after FROM but column names are variable?
Is it a good idea to create a view (A) that after FROM does not target a particular (hardcoded) table name but another view (B) that works as intermediate translation table that does just select data from a table (C) and gives it back to view (A) with columns aliased the way the first view (A) expects them. In short 2nd view (B) just acts as a translator between (A) <=> (C) in terms of table name and column names?
The reason I'm thinking about these solutions is I want to have a set of table views for application that connects to DB. And they should not change but the whole model of DB will change.
I don't want to touch the access views that are an interface for application but rather define some connections between columns and tables behind the app interface view. Also the DB model will need some other views to do common calculations/reporting but the source table data to calculations/reporting will be altered over time (column names, table names).
- Is there any other approach I could apply? How do you deal with cases of altering table names, column names in DB without breaking already implemented reporting and other functionalities that expect a particular names of tables and columns?
I'm using MySQL 8.
mysql variables view interface translators
add a comment |
I want to define a lot of views but the model of the DB is changing so there are some ideas/questions that came to my mind:
Is there any way in MySQL 8 to create view that after FROM has not hardcoded table name but table name is a variable?
Is it possible to create view that has hardcoded name of table after FROM but column names are variable?
Is it a good idea to create a view (A) that after FROM does not target a particular (hardcoded) table name but another view (B) that works as intermediate translation table that does just select data from a table (C) and gives it back to view (A) with columns aliased the way the first view (A) expects them. In short 2nd view (B) just acts as a translator between (A) <=> (C) in terms of table name and column names?
The reason I'm thinking about these solutions is I want to have a set of table views for application that connects to DB. And they should not change but the whole model of DB will change.
I don't want to touch the access views that are an interface for application but rather define some connections between columns and tables behind the app interface view. Also the DB model will need some other views to do common calculations/reporting but the source table data to calculations/reporting will be altered over time (column names, table names).
- Is there any other approach I could apply? How do you deal with cases of altering table names, column names in DB without breaking already implemented reporting and other functionalities that expect a particular names of tables and columns?
I'm using MySQL 8.
mysql variables view interface translators
add a comment |
I want to define a lot of views but the model of the DB is changing so there are some ideas/questions that came to my mind:
Is there any way in MySQL 8 to create view that after FROM has not hardcoded table name but table name is a variable?
Is it possible to create view that has hardcoded name of table after FROM but column names are variable?
Is it a good idea to create a view (A) that after FROM does not target a particular (hardcoded) table name but another view (B) that works as intermediate translation table that does just select data from a table (C) and gives it back to view (A) with columns aliased the way the first view (A) expects them. In short 2nd view (B) just acts as a translator between (A) <=> (C) in terms of table name and column names?
The reason I'm thinking about these solutions is I want to have a set of table views for application that connects to DB. And they should not change but the whole model of DB will change.
I don't want to touch the access views that are an interface for application but rather define some connections between columns and tables behind the app interface view. Also the DB model will need some other views to do common calculations/reporting but the source table data to calculations/reporting will be altered over time (column names, table names).
- Is there any other approach I could apply? How do you deal with cases of altering table names, column names in DB without breaking already implemented reporting and other functionalities that expect a particular names of tables and columns?
I'm using MySQL 8.
mysql variables view interface translators
I want to define a lot of views but the model of the DB is changing so there are some ideas/questions that came to my mind:
Is there any way in MySQL 8 to create view that after FROM has not hardcoded table name but table name is a variable?
Is it possible to create view that has hardcoded name of table after FROM but column names are variable?
Is it a good idea to create a view (A) that after FROM does not target a particular (hardcoded) table name but another view (B) that works as intermediate translation table that does just select data from a table (C) and gives it back to view (A) with columns aliased the way the first view (A) expects them. In short 2nd view (B) just acts as a translator between (A) <=> (C) in terms of table name and column names?
The reason I'm thinking about these solutions is I want to have a set of table views for application that connects to DB. And they should not change but the whole model of DB will change.
I don't want to touch the access views that are an interface for application but rather define some connections between columns and tables behind the app interface view. Also the DB model will need some other views to do common calculations/reporting but the source table data to calculations/reporting will be altered over time (column names, table names).
- Is there any other approach I could apply? How do you deal with cases of altering table names, column names in DB without breaking already implemented reporting and other functionalities that expect a particular names of tables and columns?
I'm using MySQL 8.
mysql variables view interface translators
mysql variables view interface translators
asked Mar 25 at 21:10
JimmixJimmix
1,0408 silver badges18 bronze badges
1,0408 silver badges18 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
- No
- No
- You can certainly do this and it is not uncommon to have views based on views. Whether it is a good idea, that's a matter of opinion.
- You cannot fully protect applications from underlying data model changes. If you introduce, remove, or change columns / columns in the data model, you must reflect them in the reports / applications, since the available content will change. If a table or column gets renamed, that can be hidden from the application through the use of views. However, if the rename is not that important so that you would reflect that in the report / application, then it begs the question why you need to rename the column.
If your data structure changes so frequently, then an SQL-based product may not be the right thing for you, since SQL requires quite rigid definition of the data structure. You may have to consider a NoSql solution instead that allows greater flexibility in the database schema. However, data structure changes will affect the application / reporting even if you use a NoSql solution.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55346447%2fmysql-create-view-targeting-variable-table-name-columns-names%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
- No
- No
- You can certainly do this and it is not uncommon to have views based on views. Whether it is a good idea, that's a matter of opinion.
- You cannot fully protect applications from underlying data model changes. If you introduce, remove, or change columns / columns in the data model, you must reflect them in the reports / applications, since the available content will change. If a table or column gets renamed, that can be hidden from the application through the use of views. However, if the rename is not that important so that you would reflect that in the report / application, then it begs the question why you need to rename the column.
If your data structure changes so frequently, then an SQL-based product may not be the right thing for you, since SQL requires quite rigid definition of the data structure. You may have to consider a NoSql solution instead that allows greater flexibility in the database schema. However, data structure changes will affect the application / reporting even if you use a NoSql solution.
add a comment |
- No
- No
- You can certainly do this and it is not uncommon to have views based on views. Whether it is a good idea, that's a matter of opinion.
- You cannot fully protect applications from underlying data model changes. If you introduce, remove, or change columns / columns in the data model, you must reflect them in the reports / applications, since the available content will change. If a table or column gets renamed, that can be hidden from the application through the use of views. However, if the rename is not that important so that you would reflect that in the report / application, then it begs the question why you need to rename the column.
If your data structure changes so frequently, then an SQL-based product may not be the right thing for you, since SQL requires quite rigid definition of the data structure. You may have to consider a NoSql solution instead that allows greater flexibility in the database schema. However, data structure changes will affect the application / reporting even if you use a NoSql solution.
add a comment |
- No
- No
- You can certainly do this and it is not uncommon to have views based on views. Whether it is a good idea, that's a matter of opinion.
- You cannot fully protect applications from underlying data model changes. If you introduce, remove, or change columns / columns in the data model, you must reflect them in the reports / applications, since the available content will change. If a table or column gets renamed, that can be hidden from the application through the use of views. However, if the rename is not that important so that you would reflect that in the report / application, then it begs the question why you need to rename the column.
If your data structure changes so frequently, then an SQL-based product may not be the right thing for you, since SQL requires quite rigid definition of the data structure. You may have to consider a NoSql solution instead that allows greater flexibility in the database schema. However, data structure changes will affect the application / reporting even if you use a NoSql solution.
- No
- No
- You can certainly do this and it is not uncommon to have views based on views. Whether it is a good idea, that's a matter of opinion.
- You cannot fully protect applications from underlying data model changes. If you introduce, remove, or change columns / columns in the data model, you must reflect them in the reports / applications, since the available content will change. If a table or column gets renamed, that can be hidden from the application through the use of views. However, if the rename is not that important so that you would reflect that in the report / application, then it begs the question why you need to rename the column.
If your data structure changes so frequently, then an SQL-based product may not be the right thing for you, since SQL requires quite rigid definition of the data structure. You may have to consider a NoSql solution instead that allows greater flexibility in the database schema. However, data structure changes will affect the application / reporting even if you use a NoSql solution.
answered Mar 25 at 21:45
ShadowShadow
26.6k9 gold badges30 silver badges47 bronze badges
26.6k9 gold badges30 silver badges47 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55346447%2fmysql-create-view-targeting-variable-table-name-columns-names%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown