I am new to SQL, I know this is really basic but I really do not know how to do it! I am joining two tables, each tables lets say has 5 columns, joining them will give me 10 columns in total which I …
Conversion failed when converting the varchar value ‘N’ to data type int
I have been finding original balances on bonds from an “Acquisition” table, for individual “performance” quarters. It has worked for every quarter, but when I attempted to run my query on 2010Q1, I received this notice: My query is: Zero balance code is telling how the bond defaulted, …
Oracle query to calculate current age
I want to calculate current age of person from DOB(date of birth) field in Oracle table. Data type of DOB field is varchar and the is date stored in format ‘DD-MON-YY’. when I calculate current age …
ILIKE and NOT ILIKE in aws redshift different from total
I ran three following queries in amazon redshift: The count was 1554. The count was 62. The count was 85. The last two (62 + 85) should equal 1554. What am I missing? Answer Double-quotes are for identifiers: “myColumn” Single quotes are for values: ‘value’. Your examples contradict th…
SQL Server notification when query is done?
I use SQL Server Management Studio (2008 R2) and I don’t have sound/speakers. How can I get a visual notification when a query is done (perhaps a popup notification)? Currently, I have to constantly …
Python -SQL String Escape Wildcards
I tried to see if this question had been asked, which it probably has, but I couldn’t find an answer. I am querying MS SQL Server from a python script using pyodbc. I am defining a function to query …
Count number of records in subgroup while keeping a number of records in a group
I have a table with the following structure (it’s a simplified version, just to show the idea): name | city —————— John | New York Thomas | Berlin Hans | Berlin Boris | …
How to efficiently check if a table is empty?
In the program I’m currently writing there is a point where I need to check whether a table is empty or not. I currently just have a basic SQL execution statement that is Count(asterisk) from Table …
Conditional UPDATE in MySQL
I am trying to UPDATE values from a table, but I need to add some conditions. I found the function CASE, but I am not if it is the best method. Here is an example. My table is ‘relation’: userid1 | userid2 | name1 | name2 I got for example: Output: 4 | 3 | bill | jack and I
Is there a way to query and find out the version of Vertica installed?
I searched the Vertica documentation for the keywords Version and Version Number. But I couldn’t really get any mention of SQL query to select the version of Vertica installed. I thought there would …