Skip to content

Tag: sql

SQL replace a string starting with a specific character

I have a column with text/sentences that may include strings starting with ‘@’. I need to remove all strings starting with ‘@’ from the texts. For example: Is there any function that can do the trick? I have tried the following but this removes only the ‘@’ from the string:…

Add a new column from compare result

I need add a new column (status) on my main table (Table 1) on my bd Postgres, to do this , I need to compare two columns from table 1 on table 2 , if the two columns exist , I need to copy the status from table 2 to the new column on table 1 , if not exist

check statement add constraint

create table sallaary( ); Now, this is my code. The idea of the first constraint “check_hours ” is to add a bonus to the employee if his work hours exceeded 40 hours but I don’t know how to write it Note: the first constraint “check_hours ” is not complete Answer Hmmm . . . I thi…

MySQL Query to combine two tables

I’m trying to get a MySQL query to combine two tables. Both tables have a user_id and date column and the other columns are unique to each table. What I’m looking to accomplish is best explained with an image (imgur). I’ve tried various joins and unions and can’t get the right combinat…