Modify query from RDBMS to MongoDB [closed] - mongodb

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()

Related

How to select string DataFrame using contains? [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 2 years ago.
Improve this question
Using spark 2.0, I want to process the Full MovieLens Dataset.
my dataframe contains information about movies :
val moviesDF = spark.read.format("csv").option("delimiter",",")
.option("header","true").option("inferSchema", "true")
.load("/path/to/movies/")
How to select the movies such as the value for the column "tagline" contains the substring "comedy"?
You can filter it:
val comediesDF = moviesDF.filter("tagline like '%comedy%'")
Then you can show the content:
comediesDF.show(false)

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

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).

What RDBMS command is used to tell what user has what permissions on a particular object? [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 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