Tag: r

52 votes
8 answers
544 views
Pretty print in MongoDB shell as default

Is there a way to tell Mongo to pretty print output? Currently, everything is output to a single line and it&a

avatar
Percy
0 1 0 9
asked 07 September, 2021
52 votes
10 answers
1.3K views
MongoDB relationships: embed or reference?

I'm new to MongoDB--coming from a relational database background. I want to design a question structure w

avatar
Robyn
0 1 0 9
asked 07 September, 2021
51 votes
15 answers
1.8K views
How to get the last N records in mongodb?

I can't find anywhere it has been documented this. By default, the find() operation will get the records

avatar
Bryant
0 1 0 9
asked 07 September, 2021
53 votes
7 answers
603 views
When to use CouchDB over MongoDB and vice versa

I am stuck between these two NoSQL databases. In my project I will be creating a database within a database.

avatar
Margo
0 1 0 9
asked 07 September, 2021
48 votes
14 answers
3.1K views
Query for documents where array size is greater than 1

I have a MongoDB collection with documents in the following format: { "_id" : ObjectId("4e8ae86d08101908e10

avatar
Benton
0 1 0 9
asked 07 September, 2021
57 votes
16 answers
371 views
"Large data" workflows using pandas

I have tried to puzzle out an answer to this question for many months while learning pandas. I use SAS for my

avatar
Robyn
0 1 0 9
asked 07 September, 2021
61 votes
16 answers
2.1K views
DateTime2 vs DateTime in SQL Server

Which one: datetime datetime2 is the recommended way to store date and time in SQL Server 2008+? I'm a

avatar
Hallie
0 1 0 9
asked 07 September, 2021
57 votes
22 answers
2.5K views
How can I get column names from a table in SQL Server?

I want to query the name of all columns of a table. I found how to do this in: Oracle MySQL PostgreSQL But I a

avatar
Emilia
0 1 0 9
asked 07 September, 2021
55 votes
27 answers
2.1K views
How can I list all foreign keys referencing a given table in SQL Server?

I need to remove a highly referenced table in a SQL Server database. How can I get a list of all the foreign

avatar
Thurman
0 1 0 9
asked 07 September, 2021
51 votes
11 answers
2.8K views
How to Join to first row

I'll use a concrete, but hypothetical, example. Each Order normally has only one line item: Orders: Or

avatar
Gigi
0 1 0 9
asked 07 September, 2021
56 votes
14 answers
2.5K views
Should I use != or <> for not equal in T-SQL?

I have seen SQL that uses both != and <> for not equal. What is the preferred syntax and why? I like !=

avatar
Lorenzo
0 1 0 9
asked 07 September, 2021
61 votes
21 answers
1.2K views
How can I SELECT rows with MAX(Column value), PARTITION by another column in MYSQL?

My table is: id home datetime player resource 1 10 04/03/2009 john 399 2 11 04/03/2009 juliet 244 5 12 04/03/

avatar
Lawanda
0 1 0 9
asked 07 September, 2021
57 votes
30 answers
965 views
Exclude a column using SELECT * [except columnA] FROM tableA?

We all know that to select all columns from a table, we can use SELECT * FROM tableA Is there a way to excl

avatar
Patsy
0 1 0 9
asked 07 September, 2021
55 votes
21 answers
1.8K views
Function vs. Stored Procedure in SQL Server

I've been learning Functions and Stored Procedure for quite a while but I don't know why and when I

avatar
Keila
0 1 0 9
asked 07 September, 2021
63 votes
24 answers
2.6K views
Search text in stored procedure in SQL Server

I want to search a text from all my database stored procedures. I use the below SQL: SELECT DISTINCT o.

avatar
Scot
0 1 0 9
asked 07 September, 2021
48 votes
20 answers
619 views
Join vs. sub-query

I am an old-school MySQL user and have always preferred JOIN over sub-query. But nowadays everyone uses sub-qu

avatar
Charis
0 1 0 9
asked 07 September, 2021
61 votes
17 answers
1.2K views
Save PL/pgSQL output from PostgreSQL to a CSV file

What is the easiest way to save PL/pgSQL output from a PostgreSQL database to a CSV file? I'm using Pos

avatar
Dorinda
0 1 0 9
asked 07 September, 2021
54 votes
11 answers
1.1K views
Insert into a MySQL table or update if exists

I want to add a row to a database table, but if a row exists with the same unique key I want to update the row

avatar
Rudy
0 1 0 9
asked 07 September, 2021
63 votes
15 answers
1.4K views
When should I use CROSS APPLY over INNER JOIN?

What is the main purpose of using CROSS APPLY? I have read (vaguely, through posts on the Internet) that cros

avatar
Sena
0 1 0 9
asked 07 September, 2021
54 votes
12 answers
2.7K views
INNER JOIN ON vs WHERE clause

For simplicity, assume all relevant fields are NOT NULL. You can do: SELECT table1.this, table2.that, ta

avatar
Percy
0 1 0 9
asked 07 September, 2021