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 …
Tag: sql
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…
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[…
How to handle cases where array is empty in postgresql?
I have a function written in plpythonu. CREATE OR REPLACE FUNCTION temp(t_x integer[]) RETURNS void AS $BODY$ . . . x=plpy.execute(“””select array_to_string(select id from A where id=any(array%s) ),…
Postgresql delete multiple rows from multiple tables
Consider 2 or more tables: I wish to delete all users and their orders that match first name ‘Sam’. In mysql, I usually do left join. In this example userid is unknown to us. What is the correct format of the query? Answer http://www.postgresql.org/docs/current/static/sql-delete.html You can also …