Skip to content
Advertisement

Tag: mysql

How can I combine two columns and sort the values alphabetically?

I’m new to programming languages and am trying to get the customers with the longest and shortest names, combine them in a single column, and sort them by longest then shortest names. Here’s what I have. How can I query to get my desired result in MySQL? Table is orders customer_id longest lowest John Nathaniel John Michael Nathaniel Expected results

Is it possible to further filter on MAX results?

I have a table like so A) As you can see, the same ID can have multiple Revision IDs Now, I can grab all the latest revision for each ID by using MAX with GROUP BY like so: B) As you can see here, the Revision ID of 47141 is the latest revision for ID 3282 So here is my

Alter Table Foreign Key

I’m trying to add barista_grade_id to the baristas table as a foreign key and I’ve looked every where on what syntax to use and it seems to be unanimous that this is the correct way. I did it before this and it worked. but because of some mistakes I deleted it and redo it again, but for whatever reason it

How to return multiple rows in stored procedure?

I have a procedure that returns multiple rows, but separately. Please take a look at its result: I causes some issues when I want to fetch the result in the code (backend side). Now I want to create a temporary table and insert all rows inside it and then return that temp table as the result of the stored procedure.

Time difference between start/stop interactions

I have two tables in my database that looks like this learner_lessons learner_lesson_logs Basically, when a user clicks on a video it starts playing and the interaction is recorded as ‘Start’ and a timestamp is created accordingly. Now when a user pauses the video another interaction ‘Pause’ is created and the timestamp is recorded. The user might come back later

Advertisement