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

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

INSERT INTO query WITH RECURSIVE query

I have created a WITH RECURSIVE function and would like to use it with an INSERT INTO function so that the results insert into the path column. category_id category_name parent_id path 1 Root 0 2 Fishing 1 3 Sea 2 4 Lures 3 7 Coarse 2 8 Lures 7 9 Fly 2 I have tried the following code but the

SQL Select Duplicate Values based on Specific Condition

I am asking for a solution where I can find duplicate entries in a table but one of those duplicate entries MUST contain a specific value otherwise it won’t come in the result. For example, my table is like this: ID Name Type 1 Hassan Commercial 2 Ahmed Personal 3 Jack Personal 4 Hassan Commercial 5 Jack Commercial 6 Charlie

What am I getting wrong in this SQL query?

Write a query that retrieves only a ranked list of the most prolific days in October 2020, prolific measured in number of posts per day. Your query should return those days in a single-column table (column name post_day) in the format YYYY-MM-DD. This is my table: This is my query: The problem is that I’m only getting one result, not

Data inconsistencies between two tables

I have an SQL question in which I am struggling to understand and find relevant resources to help me. The question is: “Write an SQL query to identify data inconsistencies between two tables.” I need to compare the following tables of data: AssetManager AssetManagerName John Doe Joe Smith Dave Grey Lisa Sparks Kate Green Trip PropertyCode AssetManagerName Date P001 John

MySQL Where condition with CASE

Here i want like if cksp.status is not null then condition should be cksp.is_include_in_pipeline = 1 ELSE ignore the where condition Answer That logic should be similar to:

SQL: Help creating a table based on another tables value

I am new to SQL and am currently doing a project on MSQL 2019. I have one table with a list of codes mapping a “Loss ID” to a Reason. Now I have another table that just gives you the number of the Loss ID but not the text version of it. How can I create a table that will

Re: MySQL 8.0 Command Line Client Error 1205

MySQL 8.0 Command Line Client is giving me a timeout error and I have restarting the transaction by typing “start transaction” another time. Keep in mind that I have another command line open with the table CIA_DATA.new_table and it is also being updated with the same changes. (I am doing this to follow a tutorial.) Here is the script: Updated

Advertisement