Skip to content

Redshift – How to remove NOT NULL constraint?

Since Redshift does not support ALTER COLUMN, I would like to know if it’s possible to remove the NOT NULL constraints from columns in Redshift. Answer You cannot alter the table. There is an alternative approach. You can create a new column with NULL constraint. Copy the values from your old column to …

How to automate source control with Oracle database

I work in an Oracle instance that has hundreds of schemas and multiple developers. We have a development instance where developers can integrate their work before test or production. We want to have source control for all the DDL run in this integrated development database. Currently this is done through a pr…

UPDATE order in PostgreSQL

I have a mysql command: update table_demo SET flag= 1 where flag=0 ORDER BY id ASC LIMIT 10 and need the same command in Postgres, I get this error: ERROR: syntax error at or near ‘ORDER’

Do I need a where clause in a conditional UPDATE?

We imported a lot of data from another table. Now I’m trying to correct some of them. I didn’t use ELSE because many rows have valid country. My question is to know whether I need to the WHERE clause to filter the rows that will be affected? The reason I’m asking this question is that, I&#82…

Query with rownum got slow

I have got a table table with 21 millions records of which 20 millions meet the criterion col1= ‘text’. I then started iteratively to set the value of col2 to a value unequal to NULL. After I have mutated 10 million records, the following query got slow, that was fast in the beginning: I noticed t…

dash character in mysql MATCH

I have a table of documents numbered by year / series, like this: 13-201 (this would be document 201 in 2013). I want to do a MATCH AGAINST full text query for this table, so a user could grab a list …