Skip to content
Advertisement

Tag: join

Python Script to run SQL query UPDATE statement to loop through each row in result set and update columns

Newby working on my first project. Sorry for this explanation. I have 2 x tables: t1: master table with single rows (unique project-id) and 3 status fields, s1,s2,s3 t2: list table with repeating project_id’s with 3 status fields s1,s2,s3 (and other data not relevant here). The value in the s1-3 fields is either true(1) or false(0) table1: project_id, status1, status2,

Generate random pairs SQL

Suppose we have these two tables. TABLE1: TABLE_2: I want to pair all rows of TABLE_1 with some random columns from TABLE_2 where each pair is gonna have a random amount of distinct rows from TABLE_2 (range 1,2,3) An output could be: Answer did the thing for me.

Making a MySQL COUNT query

after 4 days of tries and researchs over the web I can’t make my wishes working. Any help would be appreciated ! Performed on MYSQL WORKBENCH I got a DB made of 3 tables : user Posts likes username id id id title userId (foreign key from user.id) email content postId (foreign key from posts.id) password date image imageUrl userId

left join on the first appeared row by datetime

If classes ‘Math’ or ‘Biology’ have flag is NULL or = 0, we need to left join with the first appeared (according to the date) classes ‘Literature’ or ‘English Literature’ from the below. If classes ‘Math’ or ‘Biology’ have flag = 1 then we need to left join with the most recent (according to the date) classes ‘Literature’ or ‘English

How to delete rows that have duplicate column combination

I need to delete some rows that have the same column combination (except ID). The row that should be kept is the one that has the maximum reference date So, after the query the table should be like this I know that the query below will return the table I want, but I don’t know how to delete the “duplicate”

Join same two tables multiple times in one query [closed]

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 last month. Improve this question I have problem with my query and i can not figure it how to do it. What i want to do is to display “Ban By”

show who resit and passed and what course was it?

i need help find who fail in exam & resit and pass the exam only, heres the code: heres the result: I need find like this: Answer Possibly using a query like below. this is using your query as input. Also we have assumed that it is not possible to have a student have (PASS, FAIL) for a student on

How to JOIN two table in BigQuery, but the join parameter are nested

sorry for the newbie questions, just started learning SQL. I have two tables: sessions items sessions table has questions (RECORD, Repeated), and inside questions there’s item_id (String) items table has topics (RECORD, Repeated), and inside topics there’s prior_difficulty (String). items table also has item_id (String) My objective is to get a list of sessions and its prior_difficulty, by joining the

Advertisement