Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I want to copy MySQL database while replacing some vulnerable data(e/g. email, phone, name, …
Tag: mysql
get one record at a time from joint table
I want to get a record from a joint table at a time. But I don’t hope the tables are joined as a whole. The actual tables are as follow. By specifying a cluster_id, I want to get one content name at a time where contents.status=2 and (contents name, cluster_id) pair is in content_cluster. The query in s…
How to natural sort “X-Y” string data, first by X and then by Y?
Given this data: I’ve tried several of the common natural sorting methods for mysql, but they won’t sort these in a natural descending way, like: For example: Answer Assuming the parts on either side of the – are limited to 2 digits and 5 digits respectively, you can extract the two numeric …
How to SUM two SUMmed SQL result fields
I have a simple table structure holding records of reagent_bottles and reagent_aliquots. Aliquots are created from bottles, and an aliquot record got a foreign key, bottle_id, to a bottles id. To get the total volume of a particular reagent (counting both the volume in the bottles and the volume in the aliquo…
Is there an idiom for querying sequences in SQL?
I’m studying to interview for a job involving a lot of SQL. I’ve noticed a few exercises that revolve around returning values based on a sequence across rows, and I would love to know if there’s a standard way of doing this. Something akin to the subquery below I’ve found useful for se…
MySQL transform 3 queries into one
I have 3 working simple queries. How could I transform in one query? Thanks Answer I am guessing you want:
Need to exclude the data which have multiple records
I am trying to build a query to get the the unique data from data base, but here the problem I’m facing there is some records which have multiple records and those records have null and not null values.. I have to pick the value of the record which have the latest created date and it’s data is nul…
Datetime changing on JSON response
I am selecting start and end date of a project from project_stage named table. Here is the table elements Here datatype is DATETIME Here is the code Result on JSON response Here date time is changing its not the actual datetime which is in the table,why the date is changing on result.Here is the expected outp…
Check if an element is contained in the values (array) of a json column in MySql
I have the following values inside a cell of a json column in MySql: I would like to make a query that extracts data based on the existence of a value in the array at the fornitori key. For now I’ve tried this: Which print is: Basically the condition is that value (“8”) must be inside the …
Query to obtain value among selected values in a comma separated varchar
I have an SQL table as given below How can I write a Select query such that all titles with genre “Crime” will be displayed Answer First, you should fix your data model! Storing multiple values in a column is a really, really, really bad idea. That said, sometimes we are stuck with other people…