What RDBMS command is used to tell what user has what permissions on a particular object? [closed] - rdbms

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
What RDBMS command is used to tell what user has what permissions on a particular object?

That depends on the database system you use. In Oracle, you can find out a lot by
select * from all_tab_privs;

Heres how to do it in sql server 2005
select dp.NAME AS principal_name,
dp.type_desc AS principal_type_desc,
o.NAME AS object_name,
p.permission_name,
p.state_desc AS permission_state_desc
sys.database_permissions p
OUTER JOIN sys.all_objects o
on p.major_id = o.OBJECT_ID
inner JOIN sys.database_principals dp
on p.grantee_principal_id = dp.principal_id

Related

Postgres query to make faster [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Any opinion on which query will be faster ( or no difference) and why?
select * from A a left join B b on a.id = b.cid where b.cl1 = 's1' or b.c1 ='s2' or b.c1 ='s3' ;
or
select * from A a left join B b on a.id = b.cid where b.cl1 in ('s1','s2','s3');
The above is just examples to provide idea on what I am trying to do. May not be the exact syntax.
The reason for asking the question is , I built up a spring-hibernate-JPA query similar to the first one and at this point performance is poor. Hence looking for all possible ways to make the performance better. It may or may not be the query. But not being expert on DB side, looking for information
The second query is always faster, because it can use a single index scan if you have an index on b.cl1.
But since the first query has the conditions on different columns, the queries are quite different, and it makes little sense to compare them.
In such scenarios, you can simply analyze your query by using PostgreSQL query analize and see which one is speed.
Update: As #MatBailie said on his comment, LEFT JOIN requires an ON
clause.
EXPLAIN ANALYSE
SELECT *
FROM A a
LEFT JOIN B ON b
WHERE b.cl1 = 's1'
OR b.c2 = 's2'
OR b.c3 = 's3';
EXPLAIN ANALYSE
SELECT *
FROM A a
LEFT JOIN B ON b
WHERE b.cl1 IN ('s1', 's2', 's3');

SQL - Best practice for handling mass arbitrary data [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a massive delimited file and many normalized tables to input the data. Is there a best practice for bringing in the data and inserting the data into its proper fields and tables?
For instance, right now I've created a temp table that holds all the arbitrary data. Some logic runs against each row to determine what values will be going in to what table. Without too much specifics the part that concerns me looks something like:
INSERT INTO table VALUES (
(SELECT TOP 1 field1 FROM #tmpTable),
(SELECT TOP 1 field30 FROM #tmpTable),
(SELECT TOP 1 field2 FROM #tmpTable),
...
(SELECT TOP 1 field4 FROM #tmpTable))
With that, my questions are: Is it reasonable to be using a temp table for this purpose? And is it poor practice to use these SELECT statements so liberally like this? It feels sort of hacky, are there a better ways to handle mass data importing and separation like this?
You should try SSIS.
SSIS How to Create an ETL Package

Modify query from RDBMS to MongoDB [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
select col1, col2 from table1 where col1 > 10
What will be query in MongoDB ?
The query should be like :
db.table1.find({col1:{$gt:10}},{col1:1,col2:1})
For more information read this document : db.collection.find()

What is a 'Schema' in PostgreSQL? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
As the question clearly indicates, what is actually a Schema in PostgreSQL that I see in the top level of the hierarchy in pgAdmin(III)?
Ok, I'm answering my own question just to clarify any other people (who do not have time to read docs or want a more simplified version):
You can think of a Schema as a namespace/package (just like in Java or C++). For example, let us assume mydb is the name of our database, A and B is the name of two different schemas which are present in the same database (mdb).
Now, we can use the same table name in two different schemas in the same single database:
mydb -> A -> myTable
mydb -> B -> myTable
Hope, that clarifies your answer. For more detail: PostgreSQL 9.3.1 Documentation - 5.7. Schemas

DB2 RECORDSET table name converted to uppercase [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
"SQL0204N "FUSIONDBUNIT.ACQUIREDRUN" is an undefined name. SQLSTATE=42704
The table is actually AcquireRun and not ACQUIREDRUN
Following line throws the exception
pRecordSet->Open(CRecordset::dynaset, NULL,CRecordset::readOnly | CRecordset::skipDeletedRecords)
DB2 table names are not case-sensitive unless you define them with double-quotes around the name, e.g. CREATE TABLE "MySchema"."MyTable" (...) will only work if you do:
SELECT *
FROM "MySchema"."MyTable"
I won't work even if you do SELECT * FROM MySchema.MyTable because DB2 automatically folds identifiers to upper-case, unless you quote them.
However, as noted by #sl0ppy, it looks like you might have a typo, AcquireRun vs. ACQUIREDRUN (no D).