Nishtha Thakur has Published 498 Articles

How to strip all spaces from a column in MySQL?

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

To strip all spaces from a column in MySQL, you can use REPLACE() function. Following is the syntax −update yourTableName set yourColumnName=REPLACE(yourColumnName, ' ', '' );Let us first create a table −mysql> create table stripAllSpacesDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> Name ... Read More

How to use distinct and count in Android sqlite?

Nishtha Thakur

Nishtha Thakur

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

679 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

How to arrange data in s specific order in MySQL?

Nishtha Thakur

Nishtha Thakur

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

147 Views

Use ORDER BY IF() to arrange data in a specific order. Following is the syntax −select *from yourTableName ORDER BY IF(yourColumnName=yourValue1 OR yourColumnName=yourValue2 OR yourColumnName=yourValue3, yourColumnName, ~yourColumnName) ASC;Let us first create a table −mysql> create table arrangeDataInSpecificOrder    -> (    -> StudentId int,    -> StudentName varchar(20)    -> ... Read More

Clone a collection in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

654 Views

To clone a collection in MongoDB, you can use the forEach() method. Let us first create a collection with a document.The query to create a collection with a document is as follows −> db.studentInformation.insertOne({"StudentName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8bc15780f10143d8431e21") } > db.studentInformation.insertOne({"StudentName":"Robert"}); {    "acknowledged" : ... Read More

How to find if a column is auto_increment in MySQL?

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

To find if a column is auto_increment in MySQL, you can use the following syntax −select COLUMN_NAME from information_schema.columns where TABLE_SCHEMA='yourDatabaseName' and TABLE_NAME='yourTableName' and EXTRA like '%auto_increment%';Let us first create a table. Here, ClientId is set AUTO_INCREMENT −mysql> create table autoIncrementTableDemo    -> (    -> ClientId int NOT NULL ... Read More

Convert UNIX timestamp into human readable format in MySQL?

Nishtha Thakur

Nishtha Thakur

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

972 Views

To convert UNIX timestamp into a human-readable format, use the FROM_UNIXTIME() method.Let us first create a table −mysql> create table timeConversionDemo    -> (    -> dateTimeConversion bigint    -> ); Query OK, 0 rows affected (0.45 sec)Following is the query to insert records in the table using insert command ... Read More

Resolve ‘multi update only works with $ operators’ in MongoDb?

Nishtha Thakur

Nishtha Thakur

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

836 Views

You can use $set operator for this. The syntax is as follows −db.yourCollectionName.update({ }, {'$set': "yourFieldName": "yourValue" }, false, true);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.unconditionalUpdatesDemo.insertOne({"ClientName":"Larry", "ClientAge":24}); {    "acknowledged" ... Read More

MySQL query to display all the fields that contain a capital letter?

Nishtha Thakur

Nishtha Thakur

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

978 Views

To display all the fields that contain a capital letter, use the RLIKE that performs a pattern match of a string expression against a pattern.Let us first create a table −mysql> create table contains_capital_letterDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> Name varchar(100) ... Read More

How to select distinct value from one MySQL column only?

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

To select distinct value from one column only, you can use aggregate function MAX() along with GROUP BY. Let us first create a table −mysql> create table distinctFromOneColumn    -> (    -> StudentId int,    -> StudentName varchar(100)    -> ); Query OK, 0 rows affected (0.77 sec)Following is ... Read More

C++ Program to Implement Queue

Nishtha Thakur

Nishtha Thakur

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

3K+ Views

QueueThe queue which is implemented as FIFO where insertions are done at one end (rear) and deletions are done from another end (front). The first element that entered is deleted first.Queue operations are −EnQueue (int data) − Insertion at rear endint DeQueue()− Deletion from front endThis is a C++ program ... Read More

Advertisements