SQL conditional SELECT

Sounds like they want the ability to return only allowed fields, which means the number of fields returned also has to be dynamic. This will work with 2 variables. Anything more than that will be getting confusing. Dynamic SQL will help with multiples. This examples is assuming atleast 1 column is true.

grant select on view

The error message should be written like this: ORA-01720: “grant option” does not exist for COLLDESK.GESTIONES. Here’s how it works: You have 3 schemas: Schema1 – Holder of a table named “table1” Schema2 – Holder of a view “view1” selecting from schema1.table1 Schema3 – User, selecting from schema2.view1 – has no select granted on schema1.table1. … Read more

Create a temporary table in a SELECT statement without a separate CREATE TABLE

From the manual found at http://dev.mysql.com/doc/refman/5.7/en/create-table.html You can use the TEMPORARY keyword when creating a table. A TEMPORARY table is visible only to the current session, and is dropped automatically when the session is closed. This means that two different sessions can use the same temporary table name without conflicting with each other or with … Read more

How to write a SQL DELETE statement with a SELECT statement in the WHERE clause?

You need to identify the primary key in TableA in order to delete the correct record. The primary key may be a single column or a combination of several columns that uniquely identifies a row in the table. If there is no primary key, then the ROWID pseudo column may be used as the primary … Read more