How to select JSON property in SQL statement?

I have field of type json. Example value is: [{“id”: “960287”, “src_ip”: “X.X.X.X”, “filename”: “XXX-20200408092811-0”, “order_id”:…

Creating a trigger that records modifications on table A by inserting values in table B

I’m having problems with the following trigger that records when an insertion with attribute ‘numero’= 4 is made on table A by inserting into table B who made the modification and the number of …

Truncate a column that is the result of CONCAT function?

I’m trying to truncate a column that I have created in my query to display only 15 characters, however I don’t know how to. In a table (yes), in a query (no). How would I write my code to do this? …

How to validate filleds in mysql for date today and onwards?

I am trying to use the following code alter table Appointment ADD constraint chk_date check( AppointmentDate >= curdate()); However it gives the following error saying that curdate function is …

How to compare counts from subselect?

I want to compare the count between two tables. Or more to say, output if the count from table1 is greater than from table2: SELECT c1 > c2 FROM (SELECT count(*) from table1) as c1, (SELECT count(*)…

How do i create a MYSQL database locally using Database folder downloaded from github

I know the above question is incomplete. Let me explain this in brief. I downloaded the repository from this github link https://github.com/datacharmer/test_db and as per instructions on readme file i …

How to return only those customer_id who visited Santa Clara after visiting Milpitas or #5 after visiting #2

Customer_ID Region Location Store_Entry ——————————————————– D1 2 Milpitas ‘2020-10-01’ 14:03 D2 5 Santa Clara ‘…

MySQL database re-orders entries automatically

I have created a MySQL database using MySQL Workbench. In there, I have created a table, the first entries of which are: id firstName lastName 1 John Smith 2 Emma …

Simplification of SQL Query

SQL is not my specialty. I have a working query that accomplishes what I need it to, but I know there has got to be a cleaner way of accomplishing my goal. The query should return: – Name – Date of …

Calculate returns and insert into another table

I have a table MF_NAVs which holds daily NAVs of mutual funds. I want to calculate the absolute returns over 1 day, 7 day, 15 days, 1 month, 3 month, 6 month, 1 year, 3 year, 5 year & since …