Creating multiple tables/colums with one query - mysql

my task is to make tables/columns, but im not sure how would i approach to it doing with one query only?
Tables/colums can be found there: http://imgur.com/a/wMihh
I tried to manually create database via phpmyadmin (using xampp) and entered manually the tables, but that takes way too much time, can anybody direct me?

Related

How to run append query from data macro MS Access?

I have 2 table, one is local named 'Client' and other is a linked table to MySQL DB in my web-server named 'ClientSql'.
When I insert data into the table Client, I want it to be insert into clientSql too. I try it with data macro (after insert), but it shows me an error saying
It's not possible in linked tables.
I have tried to create an append query successfully, and it works, but it just works if I execute it manually. My question is:
Is it possible to call it from a data macro? if is possible, can you show me how? If not, can you point me to a solution?
I'm not sure why you should be able to do it manually, but not via a macro. According to this link
http://dev.mysql.com/doc/connector-odbc/en/connector-odbc-examples-tools-with-access-linked-tables.html
you should be able to do it either way.
Another thought is to eliminate the local access client table and have the access program update the mySql table directly. However, if another program is accessing the client table at the same time, this could become tricky due to multi-user and locking situations.

Laravel 4 - copy a table from one databse to another

I am using Laravel 4 to build a site that uses a large number of mysql databases, where each database has multiple tables. The structure and organization of the databases is not within my control.
I need to be able to replicate a table from one database in another database at run time (the source database and destination database (and the specific table within the source database are dependent on choices made by the user).
Duplicating a table is easy to do with mysql:
CREATE TABLE database2.new_table LIKE database1.original_table;
INSERT INTO database2.new_table SELECT * FROM database1.original_table;
but I cannot figure out how to do it with Laravel.
I can easily access each database by creating their own connections ('mysql1' and 'mysql2') but I can't figure out how to construct the statement to use both. The following doesn't work
$success = DB::connection('mysql2')->statement('CREATE TABLE new_table LIKE database1.original_table);
because I am trying to access database1 directly without using the 'mysql1' connection, and Laravel generates an error saying that database1.original_table doesn't exist.
I feel like the solution should be obvious but don't have enough experience with Laravel to figure it out. Any guidance would be greatly appreciated.

help me restore a database

I have a database backup that I'm trying to load so that I can extract some historical averages. I think it was a MySQL database, but with some syntax adjustments I was able to create the one and only table I need in Oracle 11g. However, I'm having problems with the INSERT INTO portion of the backup. Basically, some of these text fields were taken directly from fields on our website, and whenever users entered an apostrophe, it messes up everything that follows. Finding all instances of this would take a very long time...
Is there any way to handle this?
Also, all the text in SQL Developer runs horizontally on 2 or 3 rows. Is there any way to fix that? It makes for a lot of side-scrolling instead of vertical scrolling.
Use phpMyAdmin to reload the database into mySQL.

MySQL Error 2013 after a failed attempt to import

I was importing one table in a MySQL Server when the power went down. After this event I tried to query the table I was importing, but got the error 2013, only when I'm querying this table (the others work just fine).
I have physical access to the server, tried to execute any query from there (tried to SELECT, and even DROP TABLE) but still got the same error.
Does anybody know a solution where I can re-build only the table (without building the whole schema from scratch?)
I'm adding this as an answer rather than having lots of comments underneath. I must state in advance that I've not used MySQL but I have used SQL server a lot so I'm hoping that something I say may help.
You say the table is still there. Was it created as part of the operation you were doing or had it been there for a while?
What happens if someone else or a different account tries to access this table?
Is there anything on this page that is relevant to your problem?
http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

How to amend a "MakeTable" queries properties in code -

I have an Access 2010 database which has two MakeTable queries. The associated filename to where it the query will make a table currently needs to be changed manually when moving the database between environments.
This recently caused an issue when the database went live as it was making the table against the test version in the back end database.
We have library code which auto-relinks tables when a database moves between environments but is is possible to also change the 'File Name:' which the make table is looking for in vba code?
Any help would be much appreciated.
You can edit queries from code like this:
Currentdb.QueryDefs("YourMakeTableQuery").SQL = "INSERT NEW QUERY HERE"
I don't know how your current query looks, but you just have to rebuild it here and insert the correct database path.