How to find a speicifc entry in tables in a database mysql? - mysql

I have a database wordpress consisting a lot of tables. I am looking for a certain entry 20.22.31.44. What is the best way to return the table and column if this entry exists?

You can dump your database data (SQLDump) into a file and search through it's content.
You may also use a Database Management system (i.e. Workbench, PHPMyAdmin) to perform that global search for you. See related.

Related

MySQL: Automate Data Ingestion from regular txt/csv files to a Database

Intro
I've searched all around about this problem, but I didn't really found a source of knowledge about this, so I'm sorry if this problem seems basic to you, but for me is rather quite intriguing due the fact that I'm having hard time to guess what keywords to use on google in order to retrieve proper info.
Problem Description :
As a matter of fact, i have to issues that i don't know how to deal in a MySQL instance installed in a laptop in a windows environment:
I have a DB in MySQL with 50 tables, of with 15 or 20 tables are tables with original data. The other tables were tables that i generated from the original data tables, in order to properly create tables that would allow me to analyze data in PowerBI. The original data tables are fed by dumps from a ERP Database.
My issue is the following:
How would one automate the process of receiving cumulative txt/csv files (via pen-drive or any other transfer mechanism), store those files into a folder and then update the existing tables with the new information? Is there any reference of best practices to deal with such a scenario?
How can i maintain the good shape of my database with the successive data integration, I mean, how can I make my database scalable and responsive?
Can you point me some sources that would help me with this?
At the moment I imported data into tables, in 2 steps:
1st - I created the table structure with the Workbench import wizard help ( I had to do it this way because the tables have a lot of fields - dozens of them, literally, and those fields need to be in the database). I also inserted primary keys and indexes in those tables;
2nd - I Managed to load the data from the files into those tables, using LOAD DATA IN FILE command.
Some of the fields of the tables created with the import wizard, were created as data type text, with is not necessary in this scenario. I would like to revert those fields to data type NVARCHAR(255) or something, However there are a lot of field to alter the data type and in multiple tables at this point, and i was wondering if i can write a query to do the job of creating all the ALTER TABLES statements i need.
So my issue here is: is it safe to alter the data type in multiple fields in multiple columns (in this case i would like to change fields with datatype text to NAVARCHAR(255))? What is the best way to do this? Can you point me to some sources or best practices for this, please?
Thank you, in advance, for your help.
Cheers
You need a scripting language, not a UI. See mysql commandline tool, the shell of your OS, etc, etc.
DROP DATABASE and reCREATE it
LOAD DATA
Massage the data to get the columns cleaner than what the load data provided
Sic the BI tool on the data.
If you want to discuss Step 3, we need details about what transformations are needed between step 2 and step 4. That includes providing the format or schema for steps 2 and 4.

Microsoft Access, Splitting Error

I'm implementing my first Access Database. I've read numerous guides/manuals, and I believe I'm nearly at the finish line. The Access Database will be used by 3-4 users.
I have three tables, all of which are "live" connections to three different Excel file. These Excel files are on a shared drive, which are to be updated periodically by the different users.
I have a single query that uses each of the different tables (3).
The goal is to give the users the ability to view the output of the query. From my understanding, the best way to structure Access is to split the database. I'd like the three tables to be stored in the "Back-End" database, and the Query to be on the "Front-End" database.
The issue that I'm running into is that, when using the "Database Splitter", I'm given the error "There are no tables in this database. The back-end database will be empty". I've searched for the past couple hours, but I can't seem to find a reason for this error. I believe it is quite clear that I do indeed have tables. What am I missing? Any input/suggestions are greatly appreciated!
The "Database Splitter" can be used when you have tables and front-end things in your database. The "Splitter" would then create an additional Access database, "move" the tables to the new database and create linked tables in the old database that map the the tables in the new database. You already have linked tables, so there's nothing to split (your linked tables are not even Access tables).

SQL database backup and restore on user id

I have a database which contains details about user information.The database contains 20 tables with users specific details.Every table contains user foreign key. I want to be able to backup specific user data from the database and restore the backup. Is it possible to restore the backup on a different database that has same tables. I am working on this but not able to find a documentation or article on this. If you could help me on this if doing this is possible. Thank you in advance
You need to write some SQL to export the data. You can use a number of techniques for example:
Gather data using views, stored procedures or a combination of both.
Export data using linked servers, import export or SSIS.
There is no backup and restore functionality for a subset if data.
(p.s. This is for SQL Server. You have three different database engines in your tags.)

How to compare two databases' altered tables

I have inserted new columns in one database, and I now want to add the same type of columns to a second database. I need to know which columns are in the first database that are not in the second. I have many tables in each database that needs column difference comparing. I searched the web and I can only find ways to see the difference of the contents of columns in two tables. I don't need to compare the contents, just different columns in all the tables in each database. Each database has the same tables.
Thanks!
I found that you can do a database dump that just has the structure from phpmyadmin.
Are you doing this manually? You could just use SHOW CREATE to see the structure of the tables, and then something like the diff command in Linux to compare them.
For a commercial product answer: I use Red Gate's SQL Compare which works great. It can compare the entire schema of two databases. It can also update your target database to match your source database.
Use redgate SQL compare to comapre schema of two tables.
sql-dbdiff works well too. Its an open source.

Combine several mssql database to one mysql with php

We are handling a data aggregation project by having several microsoft sql server databases combining to one mysql database. all mssql database have the same schema.
The requirements are :
each mssql database can be imported to mysql independently
before being able to import each record to mysql we need to validates each records with a specific createrias via php.
each imported mssql database can be rollbacked. It means even it already imported to mysql, all the mssql database can be removed from the mysql.
we would still like to know where does each record imported to the mysql come from what mssql database.
All import process will be done with PHP .
we have difficulty in many aspects. we don't know what is the best approach to solve our problem.
your help will be highly appreciated.
ps: each mssql database has around 60 tables and each table can have a few hundred thousands .
Don't use PHP as a database administration utility. Any time you build a quick PHP script to transfer records directly from one database to another, you're going to cause yourself a world of hurt when that script becomes required for production operation.
You have a number of problems that you need solved:
You have multiple MSSQL databases with similar if not identical tables.
You have a single MySQL database that you want to merge the data into.
The imported data must be altered in a specific way before being merged.
You want to prevent all duplicate records in your import.
You want to know what database each record originally came from.
The solution?
Analyze the source MSSQL databases and create a merge strategy for them.
Create a database structure on the MySQL database that fits the merge strategy in #1, including all the new key constraints (like unique and foreign keys) required for the consolidation.
At this point you have two options left:
Dump the data from each of the source databases into raw data using your RDBMS administration utility of choice. Alter that data to fit your merge strategy and constraints. Document this, and then merge all of the data into your new database structure.
Use a tool like opendbcopy to map columns from one database to another and run a mass import.
Hope this helps.