Anvi Jain has Published 629 Articles

New line separator doesn't work for group_concat function in MySQL? How to use it correctly?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

1K+ Views

To use new line separator in group_concat() function, follow the below syntax −select group_concat(concat_ws(' ', yourColumnName1, yourColumnName2) SEPARATOR "\r") from yourTableName;Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    FirstName varchar(20),    LastName varchar(20)    ); Query OK, ... Read More

Java Program to create a layout using GridBagLayout

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:26

161 Views

The GridBagLayout creates a grid bag layout manager. It arranges the components in a horizontal and vertical manner.Here, we have a frame and panel. The panel has two components arranged using GridBagLayout −JFrame frame = new JFrame("Demo Frame"); JPanel panel = new JPanel(); JLabel label = new JLabel("Email-Id: "); JTextArea text ... Read More

Querying an array of arrays in MongoDB?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

758 Views

Use $in operator to query an array of arrays in MongoDB. To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.arrayOfArraysDemo.insertOne({"EmployeeName":"Larry", "EmployeeSkills":[["Java", "MongoDB", "MySQL", "SQL Server"]]}); {    "acknowledged" : true,    "insertedId" : ... Read More

What is Decade class in JavaTuples?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

77 Views

A Decade class is a Tuple with 10 elements. It is in the JavaTuples library. The following is the declaration −public final class Decade extends Tuple implements IValue0, IValue1 , IValue2, IValue3, IValue4, IValue5, IValue6, IValue7, IValue8, IValue9Let us first see what we need to work with JavaTuples. To work ... Read More

Find a document with ObjectID in MongoDB?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

261 Views

To find a document with Objectid in MongoDB, use the following syntax −db.yourCollectionName.find({"_id":ObjectId("yourObjectIdValue")}).pretty();To understand the above syntax, let us create a collection with the document. The query to create a collection with a document is as follows −> db.findDocumentWithObjectIdDemo.insertOne({"UserName":"Larry"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c90e4384afe5c1d2279d69b") } > ... Read More

How can I use 'Not Like' operator in MongoDB?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

852 Views

For this, use the $not operator in MongoDB. To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.notLikeOperatorDemo.insertOne({"StudentName":"John Doe"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8a29c393b406bd3df60dfc") } > db.notLikeOperatorDemo.insertOne({"StudentName":"John Smith"}); {   ... Read More

How to filter data using where Clause and “IN” in Android sqlite?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

139 Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to ... Read More

What is the equivalent of SQL “like” in MongoDB?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

258 Views

You can use “$regex” operator to implement the equivalent of SQL ‘like’ in MongoDB. To implement it, let us create a collection with a document. The query to create a collection with a document is as follows −> db.sqlLikeDemo.insertOne({"UserName":"John Smith", "UserAge":24}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c912e124afe5c1d2279d6a5") ... Read More

Create LabelValue Tuple from a List collection in Java

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

60 Views

To create LabelValue tuple from a List collection, use the fromCollection() method. Here, we will be creating LabelValue from List, therefore use the fromCollection() method.Let us first see what we need to work with JavaTuples. To work with LabelValue class in JavaTuples, you need to import the following package −import ... Read More

Delete a collection from MongoDB with special characters?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

428 Views

In order to delete the collection which has some special characters like _ or -, you need to use the following syntax −db.getCollection("yourCollectionName").drop();To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.createCollection("_personalInformation"); { "ok" ... Read More

Advertisements