Skip to content
Advertisement

Tag: varchar

Can’t alter column type to a shorter VARCHAR in Redshift. Getting “target column size should be greater or equal to current maximum column size”

I’m trying to run in Amazon Redshift, but I’m getting this error: SQL Error [500310] [0A000]: Amazon Invalid operation: cannot alter column “column_name” of relation “table_name”, target column size 256 should be greater or equal to current maximum column size 879; I’ve already tried and in order to reduce this maximum column size of 879, but I still get the

PIVOT with 3 tables and JOIN without number values

Hope someone can help me or point me to the right direction. I’m more of a beginner in sql language. I have 3 table users, dataTypes and usersData I only managed to use join on three tables like this: That gets all the entries for every single user like this and then repeating multiple times the same user id: However

Can I use VARCHAR as the PRIMARY KEY?

I have a table for storing coupons/discounts, and I want to use the coupon_code column as the primary key, which is a VARCHAR. My rationale is that, each coupon will have a unique code, and the only commands I will be running are SELECT … FROM … WHERE coupon_code=’..’ I won’t be doing any joins or indexing, and I don’t

SQL BETWEEN for text vs numeric values

BETWEEN is used in a WHERE clause to select a range of data between two values. If I am correct whether the range’s endpoint are excluded or not is DBMS specific. What I can not understand in the following: If I have a table of values and I do the following query: The query returns as results rows including calories

Advertisement