Nishtha Thakur has Published 564 Articles

How to use distinct and count in Android sqlite?

Nishtha Thakur

Nishtha Thakur

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

493 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

Difference between a virtual function and a pure virtual function in C++

Nishtha Thakur

Nishtha Thakur

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

6K+ Views

Following table shows the difference between Virtual and Pure Virtual Function:Virtual FunctionPure Virtual FunctionVirtual function has their definition in the class.Pure virtual function has no definition.Declaration: virtual funct_name(parameter_list) {. . . . .};Declaration: virtual funct_name(parameter_list)=0;It has no concept of derived class.If a class contains at least one pure virtual function, ... Read More

Tokenizing a string in C++

Nishtha Thakur

Nishtha Thakur

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

5K+ Views

In this section, we will see how to tokenize strings in C++. In C we can use the strtok() function for the character array. Here we have a string class. Now we will see how to cut the string using some delimiter from that string.To use the C++ feature, we ... Read More

How to arrange data in s specific order in MySQL?

Nishtha Thakur

Nishtha Thakur

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

87 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

579 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

C++ Program to Implement Bitap Algorithm for String Matching

Nishtha Thakur

Nishtha Thakur

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

329 Views

This is a C++ Program to Implement Bitap Algorithm for String Matching. The algorithm tells whether a given text contains a substring which is “approximately equal” to a given pattern, where approximate equality is defined in terms of Levenshtein distance — if the substring and pattern are within a given ... Read More

Convert UNIX timestamp into human readable format in MySQL?

Nishtha Thakur

Nishtha Thakur

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

720 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

645 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

689 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

Advertisements