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
Tag: varchar
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
Querying SQL column varchar6 containing numbers with a between statement
The table has a column that is type varchar6 containing 6 numbers between 000000 to 999999, or is empty. No matter what values you give the various variables for this column SEQ, it keeps returning no results but no syntax errors. I suspect you can’t find anything in SQL if you do a between with two varchar6’s. The sql query
Convert varchar to date in Oracle SQL with month name
I have 2 columns in a large data set. Col 1 “review_date” is a varchar “September 16, 2019” I would like to have this information in DATE format as 09/16/2019 Col 2 “complete_date” is a varchar “…
Postgresql: In-Row vs Out-of-Row for text/varchar
Two part question: What is Postgresql behavior for storing text/varchars in-row vs out-of-row? Am I correct in thinking that with default settings, all columns will always be stored in-row until the …
MySQL – Select only numeric values from varchar column
Consider the following table : How can I write a select statement that would only return the numeric values like SQLFiddle Answer
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
Is the LIKE operator case-sensitive with SQL Server?
In the documentation about the LIKE operator, nothing is told about the case-sensitivity of it. Is it? How to enable/disable it? I am querying varchar(n) columns, on an Microsoft SQL Server 2005 installation, if that matters. Answer It is not the operator that is case sensitive, it is the column itself. When a SQL Server installation is performed a default
SQL Server Convert Varchar to Datetime
I have this date format: 2011-09-28 18:01:00 (in varchar), and I want to convert it to datetime changing to this format 28-09-2011 18:01:00. How can I do it? Answer