Skip to content

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 …

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 …

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