Skip to content

Tag: sql

Postgresql find by two columns

I have join table tags_videos How can I select distinct video_id who have two specific tag_id For example my tag_ids is 1195 and 1198, i should get video_ids 15033 and 15036 (who have 1195 and 1198 tag_id) Answer Extract the unique (tag_id, video_id) pairs for the two tags in t CTE and select these video_id&#…

PostgreSQL – I have a Syntax error in my SUBSTRING query

I’m trying to make use of the SUBSTRING() function to extract a substring from vm.location_path, starting at the second character and ending at the position of the ‘]’ character, minus two. I want to extract the text between the square brackets ([]) in vm.location_path but I’m hitting …

How do I correctly map letters in the database?

I have two tables. One table with the letters of different countries and a second table with a mapping of these letters to each other. I need to make a query to get the mapped letters of the two languages. Can you tell me how this can be done optimally? The letter table id letter language 1 A en 2

SQL – Finding Duplicate Records based certain criteria

I have these records in the table – employee_projects id employee_id project_id status 1 emp1 proj1 VERIFIED 2 emp2 proj2 REJECTED 3 emp1 proj1 VERIFIED 4 emp1 proj3 REJECTED 5 emp2 proj2 REQUIRED 6 emp3 proj4 SUBMITTED 7 emp4 proj5 VERIFIED 8 emp4 proj6 VERIFIED 9 emp3 proj4 REQUIRED Here are the crite…

joining two columns sql query

world! I’m currently stuck on this problem where i want to join two columns and run the select statement of the two, but i’m getting errors; these are the columns i want to join: and where in the second, for every row, i count how many equal rows i have for each value. the two columns values: firs…