Skip to content
Advertisement

Tag: mysql

Sync columns(without data) in multiple tables

I have multiple tables inside my database: Is there a way to keep the columns of all the tables in sync with each other? What I mean is that when I add a new column named ‘⁣last-edit’ inside the first table, this column will duplicate to all the other tables. But the data inside the columns will only be unique

How to wirte an select with forigin keys and such

I am about to setup a sql db, not decided yet for mysql, mariadb or postgresql. But before that I have set up my sql script to create the tables I need. First I need help with a sanity check, can you without me see what I am setting up here? Second, the thing I am struggeling with now is

Mysql count with GROUP_CONCAT while using join query

I have a chats table and chat_reactions table. Each chat message can have many reactions and a reaction is a text and it can be many. I am trying to return messages with the grouped reactions and the total number of times a particular reaction is used. For example, msg: hi with id 1 got a total of three reactions.

Target table cannot be same one for update clause in mysql

I have a table name named ’employee’. Table creation code given below: The table content is like below: Now I want to update ‘e_id’, first it will check whether the same e_id is in the table anywhere or not, if it is not in the table then only it will update the rows with given e_id, else it will not

Advertisement