Need help figuring out how to determine if the date is the same ‘day’ as today in teradata. IE, today 12/1/15 Tuesday, same day last year was actually 12/2/2014 Tuesday. I tried using current_date – INTERVAL’1’Year but it returns 12/1/2014. Answer You can do this with a bit of ma…
How to revoke MySQL user privileges for one table?
When I have granted privileges to a user for some specific tables: How do I revoke the privileges for this user, just for table1? Answer Google is your friend! http://dev.mysql.com/doc/refman/5.7/en/revoke.html Syntax: To further explain this answer – I’ll teach how to fish (rather than just give …
How to replace all the dots before @ in an email with empty string in Oracle SQL?
I want to replace all the dots before @ in an email with empty string in oracle query like: Answer Instr – To identify the position(@) Substr – To extract data between start(1) and end(@) position Replace – To replace . with ” || – To concatenate two strings Try this Result: SqlF…
SQL query to group by datetime and get total values for 2 other fields
I have a problem writing the sql query that will group a datetime column (Modified) into days, and for each day give me the count of a value of another field, Status which can be either 1 or 2. I …
Combine two queries from different tables and sort by a common column?
I have this two queries And Is there any simple way to get both results in the same query and sort by fecha column? and would it be possible to add a field to determinate which table is a row from? Answer you can use union: EDIT: for your additional request, to add a column indicating from which table it
Atomically set SERIAL value when committing transaction
Say I have a table where I want to use a serial as primary key to ask for changes from the client. The client will ask “give me the changes after key X”. Without using SERIALIZABLE isolation level or locking, this is prone to race conditions. Transaction A can start first, and do its writes, then …
Add emoji / emoticon to SQL Server table
I am trying to insert emoji / emoticons to a SQL Server database but it just stores ??? instead of the emoji / emoticons. I am finding only help for SQL Server not MySQL. I tried : link but not finding answers even not able to set with : SQL Server does not recognize this command. This is only for
XML Schema totalDigits/fractionDigits vs. SQL precision/scale
I’d like to find out the correspondence between XML Schema totalDigits/fractionDigits and SQL numeric precision/scale. 1) Assume we have the following simple type: How would I represent it in SQL? Let’s assume HSQL dialect (it does not matter much). I’m interested in the most restrictive SQL…
INNER/LEFT JOIN two tables and extend result with row [closed]
I have two tables which both have a row by the name “type”. It looks like this: events: ——————————– | id | title | type | ——————————– | 1 | …
Sparksql filtering (selecting with where clause) with multiple conditions
Hi I have the following issue: All the values that I want to filter on are literal null strings and not N/A or Null values. I tried these three options: numeric_filtered = numeric.filter(numeric[‘LOW’] != ‘null’).filter(numeric[‘HIGH’] != ‘null’).filter(numeric[…